Subject: bug#19757: ignore trailing slash for `guix gc -d' /gnu/store/...something/

From: [email-masked] (Ludovic Courtès)
Date: Tue, 03 Feb 2015 21:57:04 +0100

[email-masked] skribis:

> Package: guix
> Version: 0.8.1
>
> When I invoke `guix gc -d /path', success of the command depends whether /path ends with slash or not:
>
> $ guix gc -d /gnu/store/mgqk0kv5jckrd7l5cwj68fp7cz2l4qqj-luajit-2.0.3/
> guix gc: error: build failed: path `/gnu/store/mgqk0kv5jckrd7l5cwj68fp7cz2l4qqj-luajit-2.0.3/' is not in the Nix store
>
> $ guix gc -d /gnu/store/mgqk0kv5jckrd7l5cwj68fp7cz2l4qqj-luajit-2.0.3
> finding garbage collector roots...
> cannot read potential root `/var/guix/manifests'
> deleting `/gnu/store/73b760g2nr9syhznydgly8r7vl2k9z11-profile'
> deleting `/gnu/store/mgqk0kv5jckrd7l5cwj68fp7cz2l4qqj-luajit-2.0.3'
> deleting `/gnu/store/trash'
> deleting unused links...
> note: currently hard linking saves 247.60 MiB
>
>
> * with the misleading error message it is usability bug
> * it should be safe always try to remove slash from the end
> * other commands may be affected too and the behaviour should be consistent for all commands

What behavior do you think would be appropriate when running, say:

  guix gc -d /gnu/store/mgqk0kv5jckrd7l5cwj68fp7cz2l4qqj-luajit-2.0.3/bin/lua

Should it be equivalent to:

  guix gc -d /gnu/store/mgqk0kv5jckrd7l5cwj68fp7cz2l4qqj-luajit-2.0.3

I would think so, but I’d like to have feedback.

Thanks,
Ludo’.

PS: Make sure to use [email-masked] for bug reports.