From debbugs-submit-bounces@debbugs.gnu.org Fri May 01 11:24:39 2020 Received: (at 40977) by debbugs.gnu.org; 1 May 2020 15:24:39 +0000 Received: from localhost ([127.0.0.1]:50440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUXWo-0002XN-VY for submit@debbugs.gnu.org; Fri, 01 May 2020 11:24:39 -0400 Received: from mail-qv1-f65.google.com ([209.85.219.65]:39587) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUXWl-0002XA-G7 for 40977@debbugs.gnu.org; Fri, 01 May 2020 11:24:36 -0400 Received: by mail-qv1-f65.google.com with SMTP id v38so4872700qvf.6 for <40977@debbugs.gnu.org>; Fri, 01 May 2020 08:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=d9nto3n7jkydimlZ2C2UL0Nj3HDDgQoIkjdBXfTgNzg=; b=W4EiKX1TKN8be8rdjb+ixPxlMGMa9Dr7YBXzS+6QvCshNcZi6A9HQmLu8bWddKcp3T y91r0lGn7FgShPbqjPOKjaqGJTXgEFwWXdG/APi0bepIw2bdVsmdCVjDLmWO9ef3liU2 DlyWprl89zqNbkTg+ZfQ0zW+MT4+XvbXc+7qBoCCLtcp/0rbXgSLB/A/b5Cj5c4qtgoj 7jW8ku9IDZ1vMV4nsMlitTLZbq6L17a1qTvXxsLaJXUBewkM8r/+KTc4/FhiOthjfJJn CTp4+ZnjEUo6OcL9C56DtdSrNzfiWeG+VWQ8jeVAGCY1fwn66CGhUn/nozS41edKqSFH fDZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=d9nto3n7jkydimlZ2C2UL0Nj3HDDgQoIkjdBXfTgNzg=; b=nDnmVGY2OwD2mGsPWCHP5zZIMQoixqr5HkVvZ1uQ32xKwfgmYxVt6kDFQerqrCCNa8 wE2VzuBRLuhU1P+Y6wVJq0a32utoDutIQJKXvP9xz2uX93onp3MWshQaAIet3Z8B4Bly ORpetZQ2c56m23SUDzaUhS+CT4Ed4dg8beNW9azbVDr0ZBHrnPu+u9VyV9JvXvElRnqe E4sQW3VBLDEvR157qSm6X5zemHf/gzcafvew5sZ4zmggiacTcZDiOfLgmcK8291+7UUf YwsjonRivtjzVVRL7EmQlthzjZ2eBTbR6nYbcOQTqhz6JYzMpYJajTsRnJgNG/jbPi7m XCoA== X-Gm-Message-State: AGi0PuZUIZ3dLJAV/QG1WO3IT6DNEg0xhfdFHnfbiV0S7po27mkRnhPE Gbwm5JqQua6ikio0yW51oLAJ56DjWq5H6jecnZM= X-Google-Smtp-Source: APiQypJWK9kup8HTOnUakD9tDan3WcQN5LJb3P479vDnSiQjhpcbrz79i+ohaN+gmASRL973xBnD/7GtKcPENY/Mvuc= X-Received: by 2002:a0c:fc42:: with SMTP id w2mr4316895qvp.77.1588346669755; Fri, 01 May 2020 08:24:29 -0700 (PDT) MIME-Version: 1.0 References: <9fc5fc35-10c6-dda3-1e11-36740e4510c4@crazy-compilers.com> <52117c4b-3090-1ccf-5669-ff4c47935e19@crazy-compilers.com> <87y2qcsst3.fsf@nckx> In-Reply-To: <87y2qcsst3.fsf@nckx> From: zimoun Date: Fri, 1 May 2020 17:24:18 +0200 Message-ID: Subject: Re: bug#40977: --load-path does not honor ~ To: Tobias Geerinckx-Rice , Danny Milosavljevic , Leo Famulari , Bengt Richter Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 40977 Cc: 40977@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Dear, Sorry to be slow. On Thu, 30 Apr 2020 at 21:20, Tobias Geerinckx-Rice wrote: > Hartmut Goebel =E5=86=99=E9=81=93=EF=BC=9A > This is the wrong thing to do and makes the GNU system an > inconsistent mess. =E2=80=A6OK, *more* of an inconsistent, loveable, mes= s > ;-) 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=3D~/path/tp/my/project =E2=80=A6 > > and > > $ sudo guix system -L ~/path/to/my/project -A mypackage =E2=80=A6 > > 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 < ${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=3D~/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 < ${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=3D~/bar/ --eval "(require 'ex)" --eval "(from-til= de)" # protect ~ emacs --batch --directory=3D./~/bar/ --eval "(require 'ex)" --eval "(from-t= ilde)" --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=3D~/bar from-tilde --8<---------------cut here---------------end--------------->8--- This works. Because Guix uses the argument as it is. Note that '--load-path=3D./~/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=3D~/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 < ${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=3D~'.) 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