GNU bug report logs -
#40977
Tilde-expansion in --long-options=
Previous Next
Full log
View this message in rfc822 format
Dear,
Sorry to be slow.
On Thu, 30 Apr 2020 at 21:20, Tobias Geerinckx-Rice <me <at> tobias.gr> wrote:
> Hartmut Goebel 写道:
> This is the wrong thing to do and makes the GNU system an
> inconsistent mess. …OK, *more* of an inconsistent, loveable, mess
> ;-)
I still think that the behaviour of Guix could be considered as a bug
and inconsistent with other GNU tools, such as Emacs -- to pick one
but Emacs should be an exception in the GNU tools landscape
(inconsistent loveable mess :-))
Maybe what I am saying is irrelevant and only bikeshedding.
Like Saint-Thomas, I only believe that I see. ;-)
> It also makes
>
> $ sudo guix system --load-path=~/path/tp/my/project …
>
> and
>
> $ sudo guix system -L ~/path/to/my/project -A mypackage …
>
> suddenly result in different file names.
Emacs behaves differently; and it is what is expected (at least by me :-)).
--8<---------------cut here---------------start------------->8---
mkdir -p ${HOME}/tmp/foo
cat <<EOF > ${HOME}/tmp/foo/eg.el
(defun an-example ()
(interactive)
(message (car load-path))
(message (expand-file-name "kikoo" "~/foo/~/bar")))
(provide 'eg)
EOF
# ~ means /home/simon/
sudo emacs --batch -L ~/tmp/foo/ --eval "(require 'eg)" --eval "(an-example)"
# ~ mean /root/
sudo emacs --batch --directory=~/tmp/foo/ --eval "(require 'eg)"
--eval "(an-example)"
--8<---------------cut here---------------end--------------->8---
The first '~' is expanded by the shell so in the user's context. The
second '~' is expanded by Emacs so in the root's context.
Well, nothing new. :-)
This is not the issue, if I understand correctly.
This issue is about the subfolders named '~'.
--8<---------------cut here---------------start------------->8---
mkdir -p ${HOME}/tmp/foo/~/bar
cat <<EOF > ${HOME}/tmp/foo/~/bar/ex.el
(defun from-tilde ()
(interactive)
(message (car load-path))
(message (expand-file-name "yahoga" "~/foo/~/bar")))
(provide 'ex)
EOF
cd ${HOME}/tmp/foo
# ~ means /home/simon
emacs --batch --directory=~/bar/ --eval "(require 'ex)" --eval "(from-tilde)"
# protect ~
emacs --batch --directory=./~/bar/ --eval "(require 'ex)" --eval "(from-tilde)"
--8<---------------cut here---------------end--------------->8---
From the folder '${HOME}/foo', Emacs is run with prepending the
subfolder named '~'. The first line fails because the folder
'/home/simon/bar/' does not exist. The second '~' refers to the
correct subfolder because of the dot.
Now the behaviour of Emacs is inconsistent with the Guix's behaviour.
--8<---------------cut here---------------start------------->8---
cd ${HOME}/foo
guix show --load-path=~/bar from-tilde
--8<---------------cut here---------------end--------------->8---
This works. Because Guix uses the argument as it is. Note that
'--load-path=./~/bar/' works too.
And note that from the folder '$HOME/tmp/foo', the commands
guix show -L ~/bar from-tilde
and
guix show --load-path=~/bar from-tilde
refer to different file names. And it appears to me weirder than the
tilde expansion done as Emacs does.
--8<---------------cut here---------------s tart------------->8---
mkdir -p ${HOME}/tmp/foo/~/bar
cat <<EOF > ${HOME}/tmp/foo/~/bar/from-tilde.scm
(define-module (from-tilde)
#:use-module (guix packages)
#:use-module (gnu packages maths))
(pk (car %load-path))
(define-public from-tilde
(package
(inherit gmsh)
(name "from-tilde")))
EOF
--8<---------------cut here---------------end--------------->8---
> Please don't do it.
Well, in summary.
I have no knowledge about GNU tools and how they expand '~'.
I agree that '~' could be considered as a wart. And I do not know if
considering '~' as shortcut for $HOME is a "good practise" or not.
But I use '~' as meaning $HOME more more often than I create an
obscure subfolder named '~' (well I never did :-)). And I treat with
care the filename when I use 'sudo' because it is context switch so so
error-prone.
Maybe wrong terminology has been used with 'expanduser' but Guix
should expand '~' in agreement with the GNU Bash tilde-expansion
section IMHO.
(And this is valid for any '--long-option=~'.)
Therefore does the "it" in the Danny's and Tobias's "don't do it" mean
tilde-expansion?
Sorry again to be slow or bikeshed.
Best regards,
simon
This bug report was last modified 5 years and 24 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.