Shell: error when -m manifest is removed

  • Done
  • quality assurance status badge
Details
7 participants
  • Cayetano Santos
  • Liliana Marie Prikler
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Maxim Cournoyer
  • Maxime Devos
  • zimoun
Owner
unassigned
Submitted by
Cayetano Santos
Severity
normal
Merged with
C
C
Cayetano Santos wrote on 7 Dec 2021 09:33
(address . bug-guix@gnu.org)
yu1wnkgkduz.fsf@inventati.org
Hi guix,

Using latest guix, and considering a local manifest.scm file
with only

(specifications->manifest (list "python"))

Following command works

guix shell --container -m manifest.scm -- python3

But

guix shell --container -- python3

gives an error. However,

guix shell --container

followed by

python3

works.

So, by just removing the ’-m manifest.scm’ flag, I get an error.

Regards,

Cayetano Santos
Z
Z
zimoun wrote on 7 Dec 2021 10:26
(address . cayetano.santos@inventati.org)(address . 52347@debbugs.gnu.org)
CAJ3okZ04xtJQ7CLXYkKk7+-eji25=E4bBS53_Eb3H1cdKWrM8w@mail.gmail.com
Hi,

On Tue, 7 Dec 2021 at 09:41, Cayetano Santos via Bug reports for GNU
Guix <bug-guix@gnu.org> wrote:

Toggle quote (8 lines)
> guix shell --container
>
> followed by
>
> python3
>
> works.

It works correctly for me. With Guix f43a783:

Toggle snippet (26 lines)
$ guix shell -C -m manifest.scm -- python3 -c 'import this'
$ guix shell -C -m manifest.scm
[env]$ python3 -c 'import this'

$ guix shell -C
guix shell: warning: no packages specified; creating an empty environment
guix shell: warning: no packages specified; creating an empty environment
[env]$ python3
sh: python3: command not found
[env]$ $GUIX_ENVIRONMENT/bin/python3
sh: /gnu/store/h3al0y1pbr64gcjhmn4wn3v863vhc72a-profile/bin/python3:
No such file or directory
[env]$ $GUIX_ENVIRONMENT/bin
sh: /gnu/store/h3al0y1pbr64gcjhmn4wn3v863vhc72a-profile/bin: No such
file or directory

$ tree /gnu/store/h3al0y1pbr64gcjhmn4wn3v863vhc72a-profile
/gnu/store/h3al0y1pbr64gcjhmn4wn3v863vhc72a-profile
??? etc
? ??? profile
??? manifest

1 directory, 2 files


Cheers,
simon
C
C
Cayetano Santos wrote on 7 Dec 2021 11:07
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 52347@debbugs.gnu.org)
yu1bl1svi76.fsf@inventati.org
Problem is

guix shell -C -- python3

Tried after ’guix pull’ and problem remains.

C.

Toggle quote (53 lines)
>mar. 07 déc. 2021 at 10:26, zimoun <zimon.toutoune@gmail.com> ...

> Hi,
>
> On Tue, 7 Dec 2021 at 09:41, Cayetano Santos via Bug reports for
> GNU
> Guix <bug-guix@gnu.org> wrote:
>
>> guix shell --container
>>
>> followed by
>>
>> python3
>>
>> works.
>
> It works correctly for me. With Guix f43a783:
>
> --8<---------------cut
> here---------------start------------->8---
> $ guix shell -C -m manifest.scm -- python3 -c 'import this'
> $ guix shell -C -m manifest.scm
> [env]$ python3 -c 'import this'
>
> $ guix shell -C
> guix shell: warning: no packages specified; creating an empty
> environment
> guix shell: warning: no packages specified; creating an empty
> environment
> [env]$ python3
> sh: python3: command not found
> [env]$ $GUIX_ENVIRONMENT/bin/python3
> sh:
> /gnu/store/h3al0y1pbr64gcjhmn4wn3v863vhc72a-profile/bin/python3:
> No such file or directory
> [env]$ $GUIX_ENVIRONMENT/bin
> sh: /gnu/store/h3al0y1pbr64gcjhmn4wn3v863vhc72a-profile/bin: No
> such
> file or directory
>
> $ tree /gnu/store/h3al0y1pbr64gcjhmn4wn3v863vhc72a-profile
> /gnu/store/h3al0y1pbr64gcjhmn4wn3v863vhc72a-profile
> ??? etc
> ? ??? profile
> ??? manifest
>
> 1 directory, 2 files
> --8<---------------cut
> here---------------end--------------->8---
>
>
> Cheers,
> simon
Z
Z
zimoun wrote on 7 Dec 2021 11:18
(address . cayetano.santos@inventati.org)(address . 52347@debbugs.gnu.org)
CAJ3okZ017pt=OQjnGUxUF2cCES+nhsFSb0_wcVNq6v-STV3pMA@mail.gmail.com
Hi,

On Tue, 7 Dec 2021 at 11:10, Cayetano Santos
<cayetano.santos@inventati.org> wrote:
Toggle quote (8 lines)
>
>
> Problem is
>
> guix shell -C -- python3
>
> Tried after ’guix pull’ and problem remains.

Which revision do you use? Because using f43a783, it fails as expected. :-)

Are you running Guix on foreign distro or Guix System?


Cheers,
simon
C
C
Cayetano Santos wrote on 7 Dec 2021 11:23
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 52347@debbugs.gnu.org)
yu11r2ovhia.fsf@inventati.org
Toggle quote (16 lines)
>mar. 07 déc. 2021 at 11:18, zimoun <zimon.toutoune@gmail.com> ...

> Hi,
>
> On Tue, 7 Dec 2021 at 11:10, Cayetano Santos
> <cayetano.santos@inventati.org> wrote:
>>
>> Problem is
>>
>> guix shell -C -- python3
>>
>> Tried after ’guix pull’ and problem remains.
>
> Which revision do you use? Because using f43a783, it fails as
> expected. :-)

I’m using guix 05deb26.

Is it expected to fail when I remove the ’-m manifest’ flag and I
just run ’guix shell -C -- python3’ ?

Toggle quote (2 lines)
> Are you running Guix on foreign distro or Guix System?

Foreign, on top of ArchLinux.

C.
Z
Z
zimoun wrote on 7 Dec 2021 11:35
(address . cayetano.santos@inventati.org)(address . 52347@debbugs.gnu.org)
CAJ3okZ1UC31WaD1eDL6X_-grF6QUe785LMbpNCP3OXpZNdN1=g@mail.gmail.com
Hi,

On Tue, 7 Dec 2021 at 11:25, Cayetano Santos
<cayetano.santos@inventati.org> wrote:

Toggle quote (3 lines)
> Is it expected to fail when I remove the ’-m manifest’ flag and I
> just run ’guix shell -C -- python3’ ?

The command "guix shell -C -- python3" fails. It cannot work, because
the environment (new shell) is empty. You need to provide what this
shell has to contain, via command line package list or via manifest.


Cheers,
simon
C
C
Cayetano Santos wrote on 7 Dec 2021 11:42
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 52347@debbugs.gnu.org)
yu1r1aou22x.fsf@inventati.org
Toggle quote (18 lines)
>mar. 07 déc. 2021 at 11:35, zimoun <zimon.toutoune@gmail.com> ...

> Hi,
>
> On Tue, 7 Dec 2021 at 11:25, Cayetano Santos
> <cayetano.santos@inventati.org> wrote:
>
>> Is it expected to fail when I remove the ’-m manifest’ flag and
>> I
>> just run ’guix shell -C -- python3’ ?
>
> The command "guix shell -C -- python3" fails. It cannot work,
> because
> the environment (new shell) is empty. You need to provide what
> this
> shell has to contain, via command line package list or via
> manifest.

To my understanding, in this blog entry


they claim that "guix shell automatically loads guix.scm or
manifest.scm, from the current directory"

No need to "-m manifest.scm", then.

C.
M
M
Maxime Devos wrote on 7 Dec 2021 13:02
6910c2784f2a34bfdea1165c414ff8e21c46769c.camel@telenet.be
Cayetano Santos via Bug reports for GNU Guix schreef op di 07-12-2021
om 09:33 [+0100]:
Toggle quote (18 lines)
>
> Hi guix,
>
>   Using latest guix, and considering a local manifest.scm file
>   with only
>
>     (specifications->manifest (list "python"))
>
>   Following command works
>
>     guix shell --container -m manifest.scm -- python3
>
>   But
>
>     guix shell --container -- python3
>
> gives an error. However,

What's the error message?

Greetings,
Maxime
Z
Z
zimoun wrote on 7 Dec 2021 14:12
(address . cayetano.santos@inventati.org)(address . 52347@debbugs.gnu.org)
CAJ3okZ3+=7DJQeNNr3UhSe7zXs=Pga2qke11xLA0juZK2dUkBg@mail.gmail.com
Hi,

On Tue, 7 Dec 2021 at 11:44, Cayetano Santos
<cayetano.santos@inventati.org> wrote:

Toggle quote (5 lines)
> they claim that "guix shell automatically loads guix.scm or
> manifest.scm, from the current directory"
>
> No need to "-m manifest.scm", then.

Ah yes, sorry. Since I personally find implicit a bad thing, I have
forgotten about it. :-)
Anyway!

Indeed, there is a bug. It comes from 'stat:uid' vs 'getuid' in
'find-file-in-parent-directories'. On my machine, this

(= (stat:uid stat) (getuid))

compares 0 against 1001.


Cheers,
simon
L
L
Liliana Marie Prikler wrote on 7 Dec 2021 14:33
(address . 52347@debbugs.gnu.org)
b0c024113947bc2703ce670afadd6a65a811cc60.camel@ist.tugraz.at
Hi,

I am experiencing a similar situation without the container. At work,
I need some special Emacs packages, that I don't need/want in my normal
setup, so I do `guix shell -m manifest.scm -- emacs'. Even with the
directory added to the good noodles list, `guix shell -- emacs' fails,
probably because Guix assumes it has arguments when those really are
just the command to run. IOW the check for "when is implicit okay"
might be too narrow for this use case.

Cheers
Z
Z
zimoun wrote on 7 Dec 2021 14:41
(name . Liliana Marie Prikler)(address . liliana.prikler@ist.tugraz.at)
CAJ3okZ0afscLi4nFSqXvPgoHTFadXm0_e=nEWk2F6S38FVmF-g@mail.gmail.com
On Tue, 7 Dec 2021 at 14:33, Liliana Marie Prikler
<liliana.prikler@ist.tugraz.at> wrote:

Toggle quote (8 lines)
> I am experiencing a similar situation without the container. At work,
> I need some special Emacs packages, that I don't need/want in my normal
> setup, so I do `guix shell -m manifest.scm -- emacs'. Even with the
> directory added to the good noodles list, `guix shell -- emacs' fails,
> probably because Guix assumes it has arguments when those really are
> just the command to run. IOW the check for "when is implicit okay"
> might be too narrow for this use case.

Similar root, I guess, described by https://issues.guix.gnu.org/52347#8:-)


Cheers,
simon
L
L
Liliana Marie Prikler wrote on 7 Dec 2021 14:48
(name . zimoun)(address . zimon.toutoune@gmail.com)
42efa42e1112ce162cde1894cd43a2dc9eb927b4.camel@ist.tugraz.at
Am Dienstag, den 07.12.2021, 14:41 +0100 schrieb zimoun:
Toggle quote (18 lines)
> On Tue, 7 Dec 2021 at 14:33, Liliana Marie Prikler
> <liliana.prikler@ist.tugraz.at> wrote:
>
> > I am experiencing a similar situation without the container. At
> > work,
> > I need some special Emacs packages, that I don't need/want in my
> > normal
> > setup, so I do `guix shell -m manifest.scm -- emacs'. Even with
> > the
> > directory added to the good noodles list, `guix shell -- emacs'
> > fails,
> > probably because Guix assumes it has arguments when those really
> > are
> > just the command to run. IOW the check for "when is implicit okay"
> > might be too narrow for this use case.
>
> Similar root, I guess, described by
> https://issues.guix.gnu.org/52347#8 :-)
I am pretty sure all files are owned by the same user in my case. Can
stat:uid really return 0 then?
Z
Z
zimoun wrote on 7 Dec 2021 15:27
(name . Liliana Marie Prikler)(address . liliana.prikler@ist.tugraz.at)
CAJ3okZ0=MEowKqttsYZazSm6V14RFJZj7DmR93Wq1872x8-KHg@mail.gmail.com
Hi,

On Tue, 7 Dec 2021 at 14:48, Liliana Marie Prikler
<liliana.prikler@ist.tugraz.at> wrote:

Toggle quote (3 lines)
> I am pretty sure all files are owned by the same user in my case. Can
> stat:uid really return 0 then?

Maybe I am doing wrong but I just 'pk' in find-file-in-parent-directories. :-)

Cheers,
simon
L
L
Liliana Marie Prikler wrote on 7 Dec 2021 17:23
ac62d1852dd3c3d13dd80e1a52cec1db0a3bccd4.camel@gmail.com
Am Dienstag, den 07.12.2021, 15:27 +0100 schrieb zimoun:
Toggle quote (11 lines)
> Hi,
>
> On Tue, 7 Dec 2021 at 14:48, Liliana Marie Prikler
> <liliana.prikler@ist.tugraz.at> wrote:
>
> > I am pretty sure all files are owned by the same user in my
> > case. Can
> > stat:uid really return 0 then?
>
> Maybe I am doing wrong but I just 'pk' in find-file-in-parent-
> directories. :-)
You are doing wrong:

(if (or (not interactive?) ; true if giving -- COMMAND
disallow-implicit-load?
(options-contain-payload? opts))

So the pk in find-file-in-parent-directories should not even fire. I'm
pretty sure the interactive constraint has a reasoning that was
explained back then, so we should investigate carefully whether we want
to overthrow that. Warning, that noninteractive use of `guix shell'
requires an explicit manifest is also an option imo.

By the way, if we do search for a file, but find none, the warning
(warning (G_ "no packages specified; creating an empty environment~%"))
is displayed twice; once by auto-detect-manifest and once by guix-
environment*. We should probably change that string to something that
indicates that we've attempted to auto-load a manifest.

Cheers
Z
Z
zimoun wrote on 7 Dec 2021 18:11
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
CAJ3okZ03sOCb5ZzSKxAaWeGYx+MEbFk3hYYvJLLfhEsxcN81oQ@mail.gmail.com
Hi,

On Tue, 7 Dec 2021 at 17:23, Liliana Marie Prikler
<liliana.prikler@gmail.com> wrote:

Toggle quote (6 lines)
> > Maybe I am doing wrong but I just 'pk' in find-file-in-parent-
> > directories. :-)
> You are doing wrong:
>
> (if (or (not interactive?) ; true if giving -- COMMAND

Yes, indeed. I simply grepped "manifest" and looked at
'find-file-in-parent-directories', because if it is not called, the
"manifest" file cannot be loaded. :-) Then I incorrectly used the
wrong command line invokation. Bad day with a lot of inattentive
today. :-/


Toggle quote (6 lines)
> So the pk in find-file-in-parent-directories should not even fire. I'm
> pretty sure the interactive constraint has a reasoning that was
> explained back then, so we should investigate carefully whether we want
> to overthrow that. Warning, that noninteractive use of `guix shell'
> requires an explicit manifest is also an option imo.

I am in favour to keep it explicit. (Personally, I already find that
"guix shell" is wrong ;-))


Toggle quote (6 lines)
> By the way, if we do search for a file, but find none, the warning
> (warning (G_ "no packages specified; creating an empty environment~%"))
> is displayed twice; once by auto-detect-manifest and once by guix-
> environment*. We should probably change that string to something that
> indicates that we've attempted to auto-load a manifest.

I agree.

Cheers,
simon
C
C
Cayetano Santos wrote on 7 Dec 2021 19:11
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 52347@debbugs.gnu.org)
yu1r1ao2sj7.fsf@inventati.org
Toggle quote (5 lines)
>mar. 07 déc. 2021 at 12:02, Maxime Devos <maximedevos@telenet.be>
>...

> What's the error message?

Output to ’guix shell --container -- python3’ gives

guix shell: avertissement : aucun paquet spécifié ; création d'un
environnement vide
guix shell: erreur : python3: command not found
Backtrace:
16 (primitive-load "/usr/local/bin/guix")
In guix/ui.scm:
2206:7 15 (run-guix . _)
2169:10 14 (run-guix-command _ . _)
In ice-9/boot-9.scm:
1752:10 13 (with-exception-handler _ _ #:unwind? _ # _)
1752:10 12 (with-exception-handler _ _ #:unwind? _ # _)
In guix/store.scm:
658:37 11 (thunk)
1320:8 10 (call-with-build-handler _ _)
1320:8 9 (call-with-build-handler #<procedure 7fbb1d6516f0 at
g…> …)
In guix/status.scm:
800:4 8 (call-with-status-report _ _)
In guix/scripts/environment.scm:
951:12 7 (_)
In guix/store.scm:
2119:24 6 (run-with-store #<store-connection 256.99
7fbb2132ccd0> …)
In guix/scripts/environment.scm:
627:17 5 (_ _)
576:23 4 (validate-exit-status _ _ 32512)
In guix/utils.scm:
954:4 3 (string-closest _ _ #:threshold _)
In guix/combinators.scm:
46:32 2 (fold2 #<procedure 7fbb10e14380 at
guix/utils.scm:954:…> …)
In ice-9/boot-9.scm:
1685:16 1 (raise-exception _ #:continuable? _)
1685:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure car: Wrong type argument in position 1 (expecting
pair): #f
M
M
Maxime Devos wrote on 7 Dec 2021 20:06
(address . cayetano.santos@inventati.org)(address . 52347@debbugs.gnu.org)
4cca978c5a5a56383b076154ab671e851455c33f.camel@telenet.be
Cayetano Santos schreef op di 07-12-2021 om 19:11 [+0100]:
Toggle quote (16 lines)
> In guix/scripts/environment.scm:
>    627:17  5 (_ _)
>    576:23  4 (validate-exit-status _ _ 32512)
> In guix/utils.scm:
>     954:4  3 (string-closest _ _ #:threshold _)
> In guix/combinators.scm:
>     46:32  2 (fold2 #<procedure 7fbb10e14380 at
>     guix/utils.scm:954:…> …)
> In ice-9/boot-9.scm:
>   1685:16  1 (raise-exception _ #:continuable? _)
>   1685:16  0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> In procedure car: Wrong type argument in position 1 (expecting
> pair): #f

Seems like suggest-command-name is passing #f to string-closest instead
of a list (a bug!).
L
L
Ludovic Courtès wrote on 22 Dec 2021 23:42
(name . Cayetano Santos)(address . cayetano.santos@inventati.org)
87r1a4xnw0.fsf@gnu.org
Hi,

Cayetano Santos <cayetano.santos@inventati.org> skribis:

Toggle quote (16 lines)
> In guix/scripts/environment.scm:
> 627:17 5 (_ _)
> 576:23 4 (validate-exit-status _ _ 32512)
> In guix/utils.scm:
> 954:4 3 (string-closest _ _ #:threshold _)
> In guix/combinators.scm:
> 46:32 2 (fold2 #<procedure 7fbb10e14380 at
> guix/utils.scm:954:…> …)
> In ice-9/boot-9.scm:
> 1685:16 1 (raise-exception _ #:continuable? _)
> 1685:16 0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> In procedure car: Wrong type argument in position 1 (expecting pair):
> #f

This particular issue was fixed in
16e9e538386bf30da690502c65b8053ff266e8cb.

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 22 Dec 2021 23:49
(name . Cayetano Santos)(address . cayetano.santos@inventati.org)(address . 52347@debbugs.gnu.org)
87fsqkxnkg.fsf@gnu.org
Hi Cayetano,

Cayetano Santos <cayetano.santos@inventati.org> skribis:

Toggle quote (20 lines)
> Following command works
>
> guix shell --container -m manifest.scm -- python3
>
> But
>
> guix shell --container -- python3
>
> gives an error. However,
>
> guix shell --container
>
> followed by
>
> python3
>
> works.
>
> So, by just removing the ’-m manifest.scm’ flag, I get an error.

As Liliana noted, this is the intended behavior: auto-loading of
‘manifest.scm’ happens only for interactive use. This is to keep
non-interactive use context-independent and thereby avoid bad surprises.

Note that when ‘manifest.scm’ is auto-loaded, a message is printed; when
it’s not considered, no message is printed. Likewise, when creating an
empty environment, a warning is printed (twice even :-)).

Any suggestions on things we might improve to avoid confusion?

Thanks,
Ludo’.
M
M
Maxim Cournoyer wrote on 9 Feb 2022 16:40
Re: bug#53892: guix shell not reading manifest.scm when used with '--'
(name . Josselin Poiret)(address . dev@jpoiret.xyz)
87sfssyro9.fsf@gmail.com
merge 52347 53892
thanks

Hello Josselin!

Josselin Poiret <dev@jpoiret.xyz> writes:

Toggle quote (16 lines)
> Hi Maxim,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> --8<---------------cut here---------------start------------->8---
>> $ guix shell -C -- make
>> guix shell: warning: no packages specified; creating an empty environment
>> guix shell: error: make: command not found
>> --8<---------------cut here---------------end--------------->8---
>>
>> The last command exhibit the problem.
>
> I believe this is [1].
>
> [1] https://issues.guix.gnu.org/52347#18

Oh, I had missed it; thanks for pointing it out. I've merged the two
issues.

Thank you!

Maxim
?
Your comment

This issue is archived.

To comment on this conversation send an email to 52347@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 52347
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch