haskell / haskell/cabal

Update the documentation of the option `ignore-expiry` to make clear what it actually does

Open
#8,918 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

We need to revise the documentation of the cabal.project option `ignore-expiry` to prevent confusion. Setting this option will disable the verification of remote repositories' signature expiration on the command execution of `cabal update`, and the flag has nothing to do with the following familiar warning:

```
Warning: The package list for 'hackage.haskell.org' is *** days old.
Run 'cabal update' to get the latest list of available packages.
```

In fact, I, myself, misunderstood what the option does. This issue, as it was first written, complained that the option didn't do what I expected it to do! This issue has been updated through conversation to reflect reality. I attach below my embarrassingly mistaken original issue.

---
### The initial issue-opening comment. This is based on my misunderstanding.

**Describe the bug**
The `ignore-expiry` option doesn't have implementation in this codebase.
Therefore, our familiar warning
```
Warning: The package list for 'hackage.haskell.org' is *** days old.
Run 'cabal update' to get the latest list of available packages.
```
will not go away with `cabal --ignore-expiry`.
However this lack of implementation does not seem to be documented.

The single function `readRepoIndex`, implemented in [lines 363-415 of `Distribution.Client.IndexUtils` in `cabal-install`, `master` as of 2023-04-25T01:37:14Z (`5f77754`)](https://github.com/haskell/cabal/blob/5f77754c5ed6037e04022b03b1bb0a5e46acecd6/cabal-install/src/Distribution/Client/IndexUtils.hs#L363-L415), have the total control of the warning. This function does not have access to the status of `ignore-expiry` option! Furthermore, [the search against this repository](https://github.com/search?q=repo%3Ahaskell%2Fcabal%20globalIgnoreExpiry&type=code) does not reveal any code that inspects the field `globalIgnoreExpiry` of the data type `GlobalFlags` (defined in [lines 58-73 of `Distribution.Client.GlobalFlags`](https://github.com/haskell/cabal/blob/5f77754c5ed6037e04022b03b1bb0a5e46acecd6/cabal-install/src/Distribution/Client/GlobalFlags.hs#L58-L73)); this strongly suggests that `ignore-expiry` option has completely no influence on the behavior of `cabal-install`.

**To Reproduce**
Steps to reproduce the behavior: for example,

```console
$ REPOCACHE=[your remote-repo-cache value, e.g. $HOME/.cabal/packages]/hackage.haskell.org/01-index.tar
$ touch -d 2000-01-01T00:00:00Z $REPOCACHE
$ cabal --ignore-expiry info hello
Warning: The package list for 'hackage.haskell.org' is 8515 days old.
Run 'cabal update' to get the latest list of available packages.
* hello (program)
Synopsis: Hello World, an example package
Versions available: 1.0, 1.0.0.1, 1.0.0.2
Versions installed: [ Unknown ]
Homepage: http://www.haskell.org/hello/
Bug reports: mailto:marlowsd@gmail.com
Description: This is an implementation of the classic "Hello World"
program in Haskell, as an example of how to create a minimal
Haskell application using Cabal and Hackage. Please submit
any suggestions and improvements.
Category: Console, Text
License: BSD3
Author: Simon Marlow
Maintainer: Simon Marlow
Source repo: http://darcs.haskell.org/hello/
Executables: hello
Flags: threaded
Dependencies: base >=4.2 && <5
Cached: No
```

**Expected behavior**

For example, the shell session above should be changed to:

```console
$ REPOCACHE=[your remote-repo-cache value, e.g. $HOME/.cabal/packages]/hackage.haskell.org/01-index.tar
$ touch -d 2000-01-01T00:00:00Z $REPOCACHE
$ cabal --ignore-expiry info hello
* hello (program)
Synopsis: Hello World, an example package
Versions available: 1.0, 1.0.0.1, 1.0.0.2
Versions installed: [ Unknown ]
Homepage: http://www.haskell.org/hello/
Bug reports: mailto:marlowsd@gmail.com
Description: This is an implementation of the classic "Hello World"
program in Haskell, as an example of how to create a minimal
Haskell application using Cabal and Hackage. Please submit
any suggestions and improvements.
Category: Console, Text
License: BSD3
Author: Simon Marlow
Maintainer: Simon Marlow
Source repo: http://darcs.haskell.org/hello/
Executables: hello
Flags: threaded
Dependencies: base >=4.2 && <5
Cached: No
```

**System information**
- Operating system: MacOS 13.3.1(22E261)
- `cabal`: 3.8.1.0 OR 3.10.1.0. Absence of implementation confirmed on [`master` as of 2023-04-25T01:37:14Z (`5f77754`)](https://github.com/haskell/cabal/commit/5f77754c5ed6037e04022b03b1bb0a5e46acecd6).
- `ghc`: 9.4.4

**Additional context**
I'm writing a Haskell build environment for the judge server of a competitive programming website [AtCoder](https://atcoder.jp/home).
The server forces an offline build for each submission; we need to download and set up all dependencies on the installation time, so this feature is absolutely desirable!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.