GNU bug report logs - #60068
[PATCH 1/2] guix-install.sh: Add GUIX_ALLOW_OVERWRITE environment variable.

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Wed, 14 Dec 2022 15:57:02 UTC

Severity: normal

Tags: patch

Merged with 60069

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: 60068 <at> debbugs.gnu.org
Subject: [bug#60068] [PATCH 1/2] guix-install.sh: Add GUIX_ALLOW_OVERWRITE environment variable.
Date: Wed, 14 Dec 2022 13:25:06 -0500
Hi Tobias,

Tobias Geerinckx-Rice <me <at> tobias.gr> writes:

> Hi Maxim,
>
> Nice!  More steps towards world domination.

Eh :-)

> Maxim Cournoyer 写道:
>> +# Environment variables
>
> These sound like they should be command-line arguments.

I agree, but that'd require a loop, or GNU getopt, and I'm not motivated
enough in the moment to re-design it :-).  When we get there, we could
add an --uninstall option too.

> […]
>
> Actually, I'm not totally sold on GUIX_ALLOW_OVERWRITE.  It's not
> solving much a problem.

The problem it solves for me was that I needed to use 'guix pack'd
dependencies such as gpg, glibc for getent, and shadow's
groupadd/useradd, etc. to satisfy the install script dependencies on my
weird target OS (minimal busybox embedded OS); which are needed to be
unpacked under /gnu, thus conflicting with the requirement that /gnu
doesn't exist.

I tried a relocatable pack, but it didn't work, at least for gpg (file
not found error).

> Instead, the error message could be specific about what it considers a
> ‘previous Guix installation’ — which would be a good idea regardless —
> and tell the admin exactly what needs to be removed to continue.
>
>>      "groupadd"
>> +    "useradd"
>
> Good catch, but separate patch.  (♪)

OK!

>> -    if [[ -e "/var/guix" || -e "/gnu" ]]; then
>> +    if [[ -z $GUIX_ALLOW_OVERWRITE && (-e /var/guix || -e /gnu) ]];
>> then
>>          die "A previous Guix installation was found.  Refusing
>> to overwrite."
>> +    else
>> +        _msg "${WAR}Overwriting existing installation!"
>>      fi
>>       cd "$tmp_path"
>> -    tar --extract --file "$pkg" && _msg "${PAS}unpacked archive"
>> -
>>      _msg "${INF}Installing /var/guix and /gnu..."
>> -    mv "${tmp_path}/var/guix" /var/
>> -    mv "${tmp_path}/gnu" /
>> +    tar --extract --file "$pkg" -C /
>
> I'm still in favour of using something like ‘mktemp -d /gnu.XXXXXX’
> here if there's no security flaw I missed.  WDYT?
>
> If the overwrite functionality is kept, we should remove the old
> directories before re-populating them.

Hopefully the reason the above makes more sense is also covered by my
use case explanation above.

Is the use case/change motivation a bit clearer now?

-- 
Thanks,
Maxim




This bug report was last modified 2 years and 91 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.