From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: immerrr again Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Nov 2018 10:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 33255@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.154132891417796 (code B ref -1); Sun, 04 Nov 2018 10:56:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Nov 2018 10:55:14 +0000 Received: from localhost ([127.0.0.1]:33378 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJG3m-0004cy-1Y for submit@debbugs.gnu.org; Sun, 04 Nov 2018 05:55:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:48822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJG3k-0004ck-Mq for submit@debbugs.gnu.org; Sun, 04 Nov 2018 05:55:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJG3e-0005FP-1Q for submit@debbugs.gnu.org; Sun, 04 Nov 2018 05:55:07 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52933) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gJG3d-0005FL-UB for submit@debbugs.gnu.org; Sun, 04 Nov 2018 05:55:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJG3c-0004mC-H0 for bug-gnu-emacs@gnu.org; Sun, 04 Nov 2018 05:55:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJG3a-0005AQ-Rv for bug-gnu-emacs@gnu.org; Sun, 04 Nov 2018 05:55:04 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:36129) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gJG3a-00056N-Dh for bug-gnu-emacs@gnu.org; Sun, 04 Nov 2018 05:55:02 -0500 Received: by mail-wr1-x431.google.com with SMTP id z13-v6so3919387wrs.3 for ; Sun, 04 Nov 2018 02:55:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=0bLVJOSwcV+yBLHBI0ee3LUu+0LC1kwB7VdgSSxoOl4=; b=tYc6692oYFvO+S+HGByjZIUgMapGVi6EUhZJ7DI5Etou78mSohGMPMsZiSwek8eIWK hvDM5YAWWgjkq1g/CoPzE9lLMmHTeb1fcoSm+ziic17b4aRE9RVq8gaZXkgoGoH/idhv qiNJyCaomcPKqU7Xa7MXmt2v2Nue4cxbOKbriLfer7+NztV2kYZfGfWzgX4nkQTj3r0V JsMF7R2QzGMtdlpdJRI6OlEnAIWnyfPMEDGtqys1X8vmrs1aqTLG2LEpwlp3epR6+Fa8 BLBW0FDh06K1oqLsxcfyk4JaMLbSDjQgUMFh6RTnhBNNCA6NVNUXCA4HZymzZZnpBD0R fG/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=0bLVJOSwcV+yBLHBI0ee3LUu+0LC1kwB7VdgSSxoOl4=; b=TBVQLN4CLLLAF0K0rdZT8wKzcOMMnd49Tkv2KePUWaVBIpIGYR3Dhb1ok4ZVVOfVtx uuGevPz3DJ2tlRVBdc327PBGBGbvRDpPlOqp7ih96qPoyFj91sksHAv4o3dFVT8WFa72 QtzyDvGp7AY6EqZu93oNUJMynAzSxsymWiaU8No5tENrlAHjaKGMaZExWLjlMkIPD3PX Y1D1V0CXvrzou8P6AA5jEjD9GG/WqTGcIMe9ohDUOPk+OI2Hjqg0TsUH9WRZG307NYKw X9/m/1Xir4IyDKUNB+ZErlmeUFuaWbT/AUW6J3WdiOrKtczk//U6bq4IHPwDtk7Ab1Ua oTGw== X-Gm-Message-State: AGRZ1gK4SRRc+JenwAdNd83G5EMxaZ6zcxI/OPr3+8TAS4su6c52Jd4J VG+VHRZQvAmqcZDW2RpAQiQr6uFgt3uMZ0sHl4dzFTN0 X-Google-Smtp-Source: AJdET5exb/0A96twxBCZ41dGZpZxZkU6L89x1byfGoC9WqExM5LbFp4noHX55CWNl6U/6SRYxPQHYJnArVx3uNGQhC0= X-Received: by 2002:a5d:40cc:: with SMTP id b12-v6mr16958521wrq.133.1541328900434; Sun, 04 Nov 2018 02:55:00 -0800 (PST) MIME-Version: 1.0 From: immerrr again Date: Sun, 4 Nov 2018 11:54:49 +0100 Message-ID: Content-Type: text/plain; charset="UTF-8" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) 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: -5.0 (-----) I have recently tried to play with a clean .emacs.d directory by setting HOME=clean/home/dir, but faced an error coming from deep inside package-install. The error boils down to the fact that `expand-file-name' for some reason doubles the `default-directory' prefix when it is relative: $ emacs -Q -batch --eval '(let ((default-directory "DEFAULT-DIR/")) (print (expand-file-name "EXPANDED-DIR/")))' "DEFAULT-DIR/DEFAULT-DIR/EXPANDED-DIR/" Interestingly, if you run `expand-file-name' twice you end up with four prefixes: $ emacs -Q -batch --eval '(let ((default-directory "DEFAULT-DIR/")) (print (expand-file-name (expand-file-name "EXPANDED-DIR/"))))' "DEFAULT-DIR/DEFAULT-DIR/DEFAULT-DIR/DEFAULT-DIR/EXPANDED-DIR/" I couldn't find any requirement for DEFAULT-DIRECTORY parameter or `default-directory' variable to be absolute, so I would assume this is a bug in expand-file-name. In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2018-07-09 built on mmrcomp Repository revision: 3307353e13a9226d477c9b1a39baae76584b90b9 Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 System Description: Ubuntu 16.04.5 LTS Recent messages: Mark set Saving file /home/immerrr/.cask/cask-cli.el... Wrote /home/immerrr/.cask/cask-cli.el Saving file /home/immerrr/.cask/cask-cli.el... Wrote /home/immerrr/.cask/cask-cli.el Saving file /home/immerrr/.cask/cask-cli.el... Wrote /home/immerrr/.cask/cask-cli.el Saving file /home/immerrr/.cask/cask-cli.el... Wrote /home/immerrr/.cask/cask-cli.el Mark set Configured using: 'configure --prefix=/home/immerrr/.local' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 THREADS JSON LCMS2 Important settings: value of $LC_TIME: en_GB.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: el Minor modes in effect: magit-auto-revert-mode: t auto-revert-mode: t global-git-commit-mode: t async-bytecomp-package-mode: t global-undo-tree-mode: t undo-tree-mode: t diff-auto-refine-mode: t nameless-mode: t guide-key-mode: t whitespace-mode: t flycheck-mode: t shell-dirtrack-mode: t counsel-projectile-mode: t projectile-mode: t ivy-mode: t global-company-mode: t company-mode: t pyvenv-mode: t paredit-mode: t auto-compile-on-save-mode: t auto-compile-mode: t recentf-mode: t yas-global-mode: t yas-minor-mode: t save-place-mode: t show-paren-mode: t global-display-line-numbers-mode: t display-line-numbers-mode: t override-global-mode: t bar-cursor-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t size-indication-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /home/immerrr/.emacs.d/elpa/ample-regexps-20151023.300/init-tryout hides /home/immerrr/.emacs.d/elpa/lua-mode-20180104.626/init-tryout Features: (shadow sort mail-extr emacsbug sendmail macrostep-c cmacexp macrostep cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs ielm tar-mode git-rebase rect bug-reference py-isort executable vc vc-dispatcher magit-bookmark magit-obsolete magit-blame magit-stash magit-bisect magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-branch magit-collab ghub url-auth magit-files magit-refs magit-status magit dired-x magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode magit-core magit-autorevert autorevert filenotify magit-process magit-margin magit-mode git-commit magit-git magit-section magit-utils ido crm magit-popup log-edit message rfc822 mml mml-sec epa epg gnus-util rmail rmail-loaddefs mailabbrev gmm-utils mailheader pcvs-util add-log with-editor term ehelp esh-var esh-cmd esh-opt esh-io esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode async-bytecomp async server imenu undo-tree diff edebug network-stream puny nsm rmc company-jedi jedi-core epc ctable concurrent cap-words superword subword pipenv f eieio-opt speedbar sb-image ezimage dframe warnings pulse cl-print debug vc-git diff-mode bookmark pp company-elisp nameless guide-key popwin face-remap disp-table whitespace flycheck find-func rx jka-compr let-alist colir mmr-org-settings python tramp-sh tramp trampver tramp-compat tramp-loaddefs ucs-normalize shell pcomplete parse-time format-spec counsel-projectile projectile skeleton ibuf-macs wgrep grep ibuf-ext ibuffer ibuffer-loaddefs counsel dired dired-loaddefs compile esh-util swiper ivy-rich ivy delsel ivy-overlay ffap thingatpt traad virtualenvwrapper gud comint ansi-color s request-deferred request mail-utils url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap popup python-environment deferred subr-x company-oddmuse company-keywords company-etags etags xref project company-gtags company-dabbrev-code company-dabbrev company-files company-capf company-cmake company-xcode company-clang company-semantic company-eclim company-template company-css company-nxml company-bbdb company pyvenv paredit auto-compile packed recentf tree-widget wid-edit yasnippet derived elec-pair saveplace hydra ring lv paren solarized-dark-theme solarized-theme solarized color dash display-line-numbers mmr-dir-local-env mmr-bootstrap quelpa-use-package cl-extra advice pcase quelpa mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr help-fns radix-tree help-mode package-recipe-mode edmacro kmacro package-build-badges package-build lisp-mnt use-package use-package-ensure use-package-delight use-package-diminish use-package-bind-key use-package-core bind-key diminish cl linum-ex bar-cursor easy-mmode mmr-minimal mmr-ediff windmove time-date mule-util info finder-inf package easymenu epg-config url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 1357726 145867) (symbols 48 50837 2) (miscs 40 6306 4056) (strings 32 121140 10207) (string-bytes 1 4278168) (vectors 16 68224) (vector-slots 8 1809895 106986) (floats 8 422 1779) (intervals 56 116849 2490) (buffers 992 53) (heap 1024 76825 5884)) From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Nov 2018 12:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: immerrr again Cc: 33255@debbugs.gnu.org Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.15413344602017 (code B ref 33255); Sun, 04 Nov 2018 12:28:02 +0000 Received: (at 33255) by debbugs.gnu.org; 4 Nov 2018 12:27:40 +0000 Received: from localhost ([127.0.0.1]:33407 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJHVD-0000WT-P1 for submit@debbugs.gnu.org; Sun, 04 Nov 2018 07:27:39 -0500 Received: from mail-it1-f175.google.com ([209.85.166.175]:36661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJHVB-0000WF-FD for 33255@debbugs.gnu.org; Sun, 04 Nov 2018 07:27:37 -0500 Received: by mail-it1-f175.google.com with SMTP id w7-v6so8940130itd.1 for <33255@debbugs.gnu.org>; Sun, 04 Nov 2018 04:27:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=VBlGOGuSyWSEQ4lxUkUlKgPxi0bDD8OXXWaxpHufR70=; b=Q6ftJP6eC3YT3BZHcKBGVLztLD+HQ+she88+0zYQy7SDHqvnp5OkCyZuX4lrIstPWo SyD3DgBltBPcuEFyaUg0UFXVPNUct1O95e3ZnCLIriEMiEYnzlQaskA366YhNTnPjAQM s09A50/KWg0+ZFQCf1xiDH7h9iQKAPRIFdf1p1ZuGSwRrWR8hfx/irgOuxABgJbLtrXr QHhv3n/KkagmheIPkQMHX209T6Q3f06iEuGXGlqBA6uNFJWu7UqbgmFSJZm2PREla4Lu xeYg9LB5AAUj2+raJ5ubW8VcBzVfCe5C3Ox4kZisyAl2AbWoloe34q5yWfbdcxffQA2X sKxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=VBlGOGuSyWSEQ4lxUkUlKgPxi0bDD8OXXWaxpHufR70=; b=ONxDONhFA2UQvPbwHzlC46/MuTB8WnvatnKmufkvb0whRb1qVpJvhHafWBV5XYYnVj 8chpVt+UHKSlFAG0t7fii4Vg0ske45HffumHRKVWN2RXFU/kuwAt7+uR4Aqpqv4lIjTq hTV57TIfag4EICOqyO8mMVRwJe7HT3jct0kn4+APqLyWPRdAEe/o57XtoPXfbT7mXb+h /XIM/5O4tHQSrewnE8NIY8tusRqaHGTZYKOQCIyxVkr5If78CRFghdE1vqL9WmhW3wJ1 6wRM90BOGX4XfKx4ryndytHHBDwKlFu+aM5ntTz9mNiSW2oS87GC3dTb9q42Snz/FvrD eNrQ== X-Gm-Message-State: AGRZ1gK8NB60Y3amHZTzXHyFC+EsF+xSkPzICGnstBsOegeog+wgm7yY 1IotbhwOttApCYwSg+uott1e1kQu X-Google-Smtp-Source: AJdET5cFr/ByY5WYzl5xojSkWinmmFQ4NsdfjbOsRWRUvXJtPXp9QBNW5MQfnVPg3Elb31oEtnF8Vg== X-Received: by 2002:a02:b4ce:: with SMTP id a14-v6mr15946733jak.140.1541334451684; Sun, 04 Nov 2018 04:27:31 -0800 (PST) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id q18-v6sm11409845ioh.21.2018.11.04.04.27.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 04 Nov 2018 04:27:30 -0800 (PST) From: Noam Postavsky References: Date: Sun, 04 Nov 2018 07:27:29 -0500 In-Reply-To: (immerrr again's message of "Sun, 4 Nov 2018 11:54:49 +0100") Message-ID: <878t29hvta.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) 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 (-) immerrr again writes: > I have recently tried to play with a clean .emacs.d directory by setting > HOME=clean/home/dir, but faced an error coming from deep inside > package-install. The error boils down to the fact that > `expand-file-name' for some reason doubles the `default-directory' > prefix when it is relative: [...] > I couldn't find any requirement for DEFAULT-DIRECTORY parameter or > `default-directory' variable to be absolute, so I would assume this is a > bug in expand-file-name. (elisp) File Name Expansion says: -- Variable: default-directory The value of this buffer-local variable is the default directory for the current buffer. It should be an absolute directory name; it may start with `~'.[...] And expand-file-name is supposed to expand file names relative to default-directory, so if default-directory is itself relative I don't see how it could possibly work. So we should just mention the absoluteness requirement in the docstring as well. I think it would make sense for Emacs to expand HOME against the current directory when it starts up, if HOME is relative. That would let your motivating example succeed without error. From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Nov 2018 00:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Noam Postavsky Cc: 33255@debbugs.gnu.org, immerrr again Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.154137949321821 (code B ref 33255); Mon, 05 Nov 2018 00:59:01 +0000 Received: (at 33255) by debbugs.gnu.org; 5 Nov 2018 00:58:13 +0000 Received: from localhost ([127.0.0.1]:34443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJTDZ-0005ft-2i for submit@debbugs.gnu.org; Sun, 04 Nov 2018 19:58:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:57591) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJTDW-0005fg-Ra for 33255@debbugs.gnu.org; Sun, 04 Nov 2018 19:58:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJTDR-0002W7-0f for 33255@debbugs.gnu.org; Sun, 04 Nov 2018 19:58:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJTDO-0002Uc-F0; Sun, 04 Nov 2018 19:58:02 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1gJTDN-0002S6-63; Sun, 04 Nov 2018 19:58:01 -0500 From: Glenn Morris References: <878t29hvta.fsf@gmail.com> X-Spook: Bush Wired BLU-114/B Spammer anthrax 2600 Magazine Drug X-Ran: U`[zl):LyD"q~h@rDg\1rOQD2{*vWksv (Noam Postavsky's message of "Sun, 04 Nov 2018 07:27:29 -0500") Message-ID: <3336sg2vdy.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) 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: -6.0 (------) Noam Postavsky wrote: > immerrr again writes: > >> I have recently tried to play with a clean .emacs.d directory by setting >> HOME=clean/home/dir, I think a non-absolute HOME is a user error. Eg cd $HOME may then not be idempotent. I would use $PWD/clean/home/dir. > I think it would make sense for Emacs to expand HOME against the current > directory when it starts up, if HOME is relative. I would rather see Emacs abort with an error. Otherwise you have to eg fix up process-environment too, else child processes may behave oddly. From unknown Thu Sep 11 20:48:56 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: immerrr again Subject: bug#33255: closed (27.0.50; expand-file-name: default directory expanded twice if relative) Message-ID: References: X-Gnu-PR-Message: they-closed 33255 X-Gnu-PR-Package: emacs Reply-To: 33255@debbugs.gnu.org Date: Tue, 13 Nov 2018 18:27:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1542133622-23408-1" This is a multi-part message in MIME format... ------------=_1542133622-23408-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #33255: 27.0.50; expand-file-name: default directory expanded twice if rela= tive which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 33255@debbugs.gnu.org. --=20 33255: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D33255 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1542133622-23408-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 33255-done) by debbugs.gnu.org; 13 Nov 2018 18:26:57 +0000 Received: from localhost ([127.0.0.1]:50592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMdOq-00065G-LT for submit@debbugs.gnu.org; Tue, 13 Nov 2018 13:26:57 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:42030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMdOo-000650-HJ for 33255-done@debbugs.gnu.org; Tue, 13 Nov 2018 13:26:55 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A98A816005D; Tue, 13 Nov 2018 10:26:48 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id jA-o9DSxpBa3; Tue, 13 Nov 2018 10:26:46 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9898316009A; Tue, 13 Nov 2018 10:26:46 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 14WSGGn1P8Qh; Tue, 13 Nov 2018 10:26:46 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 738B316008F; Tue, 13 Nov 2018 10:26:46 -0800 (PST) To: Glenn Morris From: Paul Eggert Subject: 27.0.50; expand-file-name: default directory expanded twice if relative Open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3SDA 77BMRnF0FQyE+7AzV79MBN4ykiqaezQxtaF1Fy/tvkhffSo8u+dwG0EgJh+te38gTcISVr0G IPplLz6YhjrbHrPRF1CN5UuL9DBGjxuN35RLNVEfta6RUFlR6NctTjvrABEBAAHCwWUEGAEC AA8FAkyAcmQCGwwFCRLMAwAACgkQ7ZfpDmKqfjSrHA/+KzAKvTxRhA9MWNLxIyJ7S5uJ16gs T3oCjZrBKGEhKMOGX4O0GA6VOEryO7QRCCYah3oxSG38IAnNeiwJXgU9Bzkk85UGbPEd7HGF /VSeHCQwWou6jqUDTSDvn9YhNTdG0KXPM74aC+xr2Zow1O2mhXihgWKD0Dw+0LYPnUOsQ0KO FxHXXYHmRrS1OZPU59BLvc+TRhIhafSHKLwbXK+6ckkxBx6h8z5ccpG0Qs4bFhdFYnFrEieD LoGmnE2YLhdV6swJ9VNCS6pLiEohT3fm7aXm15tZOIyzMZhHRSAPblXxQ0ZSWjq8oRrcYNFx c4W1URpAkBCOYJoXvQfD5L3lqAl8TCqDUzYxhH/tJhbDdHrqHH767jaDaTB1+Talp/2AMKwc XNOdiklGxbmHVG6YGl6g8Lrbsu9NZEI4yLlHzuikthJWgz+3vZhVGyNlt+HNIoF6CjDL2omu 5cEq4RDHM44QqPk6l7O0pUvN1mT4B+S1b08RKpqm/ff015E37HNV/piIvJlxGAYz8PSfuGCB 1thMYqlmgdhd9/BabGFbGGYHA6U4/T5zqU+f6xHy1SsAQZ1MSKlLwekBIT+4/cLRGqCHjnV0 q5H/T6a7t5mPkbzSrOLSo4puj+IToNjYyYIDBWzhlA19avOa+rvUjmHtD3sFN7cXWtkGoi8b uNcby4U= Organization: UCLA Computer Science Department Message-ID: Date: Tue, 13 Nov 2018 10:26:43 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------A7FA930FA132123BB3B16DA0" Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 33255-done Cc: 33255-done@debbugs.gnu.org, immerrr again , Noam Postavsky 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: -3.3 (---) This is a multi-part message in MIME format. --------------A7FA930FA132123BB3B16DA0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > I think a non-absolute HOME is a user error. > Eg cd $HOME may then not be idempotent. That's true. However, POSIX says that sh treats ~/foo like $HOME/foo even when HOME is not absolute, and it's better if Emacs is consistent with POSIX as much as possible within the Emacs constraint that expand-file-name must expand to an absolute file name. So I implemented something along the line of Noam's suggestion by installing the attached patch into master; this should fix the bug originally reported. Unlike Noam's suggestion, this patch causes Emacs to look at the current value of HOME, not the value HOME had when Emacs started up, as that corresponds more closely to POSIX sh. --------------A7FA930FA132123BB3B16DA0 Content-Type: text/x-patch; name="0001-Act-like-POSIX-sh-if-HOME-is-relative.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Act-like-POSIX-sh-if-HOME-is-relative.patch" >From a2df04a05a68d5a4afa39cfe463f72108b31bc25 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 13 Nov 2018 09:29:14 -0800 Subject: [PATCH] Act like POSIX sh if $HOME is relative POSIX says sh ~/foo should act like $HOME/foo even if $HOME is relative, so be consistent with that (Bug#33255). * admin/merge-gnulib (GNULIB_MODULES): Add dosname. * src/buffer.c (init_buffer): Use emacs_wd to get initial working directory with slash appended if needed. (default-directory): Say it must be absolute. * src/emacs.c (emacs_wd): New global variable. (init_cmdargs): Dir arg is now char const *. (main): Set emacs_wd. * src/emacs.c (main) [NS_IMPL_COCOA]: * src/fileio.c (Fexpand_file_name): Use get_homedir instead of egetenv ("HOME"). * src/fileio.c: Include dosname.h, for IS_ABSOLUTE_FILE_NAME. (splice_dir_file, get_homedir): New functions. * src/xrdb.c (gethomedir): Remove. All callers changed to use get_homedir and splice_dir_file. * test/src/fileio-tests.el (fileio-tests--relative-HOME): New test. --- admin/merge-gnulib | 2 +- src/buffer.c | 28 ++++++------------ src/emacs.c | 20 ++++++++----- src/fileio.c | 62 +++++++++++++++++++++++++++++++++++++--- src/lisp.h | 3 ++ src/xrdb.c | 54 +++++++--------------------------- test/src/fileio-tests.el | 8 ++++++ 7 files changed, 103 insertions(+), 74 deletions(-) diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 575e3fa74a..84dcb0b875 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -30,7 +30,7 @@ GNULIB_MODULES= careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5-buffer crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer - d-type diffseq dtoastr dtotimespec dup2 + d-type diffseq dosname dtoastr dtotimespec dup2 environ execinfo explicit_bzero faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fpieee fstatat fsusage fsync diff --git a/src/buffer.c b/src/buffer.c index ac2de7d19f..90ef886b22 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5268,9 +5268,7 @@ init_buffer_once (void) void init_buffer (int initialized) { - char *pwd; Lisp_Object temp; - ptrdiff_t len; #ifdef USE_MMAP_FOR_BUFFERS if (initialized) @@ -5324,7 +5322,7 @@ init_buffer (int initialized) if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) Fset_buffer_multibyte (Qnil); - pwd = emacs_get_current_dir_name (); + char const *pwd = emacs_wd; if (!pwd) { @@ -5336,22 +5334,16 @@ init_buffer (int initialized) { /* Maybe this should really use some standard subroutine whose definition is filename syntax dependent. */ - len = strlen (pwd); - if (!(IS_DIRECTORY_SEP (pwd[len - 1]))) - { - /* Grow buffer to add directory separator and '\0'. */ - pwd = realloc (pwd, len + 2); - if (!pwd) - fatal ("get_current_dir_name: %s\n", strerror (errno)); - pwd[len] = DIRECTORY_SEP; - pwd[len + 1] = '\0'; - len++; - } + ptrdiff_t len = strlen (pwd); + bool add_slash = ! IS_DIRECTORY_SEP (pwd[len - 1]); /* At this moment, we still don't know how to decode the directory name. So, we keep the bytes in unibyte form so that file I/O routines correctly get the original bytes. */ - bset_directory (current_buffer, make_unibyte_string (pwd, len)); + Lisp_Object dirname = make_unibyte_string (pwd, len + add_slash); + if (add_slash) + SSET (dirname, len, DIRECTORY_SEP); + bset_directory (current_buffer, dirname); /* Add /: to the front of the name if it would otherwise be treated as magic. */ @@ -5372,8 +5364,6 @@ init_buffer (int initialized) temp = get_minibuffer (0); bset_directory (XBUFFER (temp), BVAR (current_buffer, directory)); - - free (pwd); } /* Similar to defvar_lisp but define a variable whose value is the @@ -5706,8 +5696,8 @@ visual lines rather than logical lines. See the documentation of DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), Qstringp, doc: /* Name of default directory of current buffer. -It should be a directory name (as opposed to a directory file-name). -On GNU and Unix systems, directory names end in a slash `/'. +It should be an absolute directory name; on GNU and Unix systems, +these names start with `/' or `~' and end with `/'. To interactively change the default directory, use command `cd'. */); DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function), diff --git a/src/emacs.c b/src/emacs.c index 512174d562..acb4959bfe 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -204,6 +204,9 @@ HANDLE w32_daemon_event; char **initial_argv; int initial_argc; +/* The name of the working directory, or NULL if this info is unavailable. */ +char const *emacs_wd; + static void sort_args (int argc, char **argv); static void syms_of_emacs (void); @@ -406,7 +409,7 @@ terminate_due_to_signal (int sig, int backtrace_limit) /* Code for dealing with Lisp access to the Unix command line. */ static void -init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd) +init_cmdargs (int argc, char **argv, int skip_args, char const *original_pwd) { int i; Lisp_Object name, dir, handler; @@ -694,7 +697,7 @@ main (int argc, char **argv) char *ch_to_dir = 0; /* If we use --chdir, this records the original directory. */ - char *original_pwd = 0; + char const *original_pwd = 0; /* Record (approximately) where the stack begins. */ stack_bottom = (char *) &stack_bottom_variable; @@ -794,6 +797,8 @@ main (int argc, char **argv) exit (0); } + emacs_wd = emacs_get_current_dir_name (); + if (argmatch (argv, argc, "-chdir", "--chdir", 4, &ch_to_dir, &skip_args)) { #ifdef WINDOWSNT @@ -804,13 +809,14 @@ main (int argc, char **argv) filename_from_ansi (ch_to_dir, newdir); ch_to_dir = newdir; #endif - original_pwd = emacs_get_current_dir_name (); if (chdir (ch_to_dir) != 0) { fprintf (stderr, "%s: Can't chdir to %s: %s\n", argv[0], ch_to_dir, strerror (errno)); exit (1); } + original_pwd = emacs_wd; + emacs_wd = emacs_get_current_dir_name (); } #if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK) && !defined (CYGWIN) @@ -1289,21 +1295,21 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem { #ifdef NS_IMPL_COCOA /* Started from GUI? */ - /* FIXME: Do the right thing if getenv returns NULL, or if + /* FIXME: Do the right thing if get_homedir returns "", or if chdir fails. */ if (! inhibit_window_system && ! isatty (STDIN_FILENO) && ! ch_to_dir) - chdir (getenv ("HOME")); + chdir (get_homedir ()); if (skip_args < argc) { if (!strncmp (argv[skip_args], "-psn", 4)) { skip_args += 1; - if (! ch_to_dir) chdir (getenv ("HOME")); + if (! ch_to_dir) chdir (get_homedir ()); } else if (skip_args+1 < argc && !strncmp (argv[skip_args+1], "-psn", 4)) { skip_args += 2; - if (! ch_to_dir) chdir (getenv ("HOME")); + if (! ch_to_dir) chdir (get_homedir ()); } } #endif /* COCOA */ diff --git a/src/fileio.c b/src/fileio.c index 7fb865809f..e178c39fc1 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -96,6 +96,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #include #include #include @@ -1093,8 +1094,7 @@ the root directory. */) { Lisp_Object tem; - if (!(newdir = egetenv ("HOME"))) - newdir = newdirlim = ""; + newdir = get_homedir (); nm++; #ifdef WINDOWSNT if (newdir[0]) @@ -1109,7 +1109,7 @@ the root directory. */) #endif tem = build_string (newdir); newdirlim = newdir + SBYTES (tem); - /* `egetenv' may return a unibyte string, which will bite us + /* get_homedir may return a unibyte string, which will bite us if we expect the directory to be multibyte. */ if (multibyte && !STRING_MULTIBYTE (tem)) { @@ -1637,7 +1637,6 @@ See also the function `substitute-in-file-name'.") } #endif -/* If /~ or // appears, discard everything through first slash. */ static bool file_name_absolute_p (const char *filename) { @@ -1650,6 +1649,61 @@ file_name_absolute_p (const char *filename) ); } +/* Put into BUF the concatenation of DIR and FILE, with an intervening + directory separator if needed. Return a pointer to the null byte + at the end of the concatenated string. */ +char * +splice_dir_file (char *buf, char const *dir, char const *file) +{ + char *e = stpcpy (buf, dir); + *e = DIRECTORY_SEP; + e += ! (buf < e && IS_DIRECTORY_SEP (e[-1])); + return stpcpy (e, file); +} + +/* Get the home directory, an absolute file name. Return the empty + string on failure. The returned value does not survive garbage + collection, calls to this function, or calls to the getpwnam class + of functions. */ +char const * +get_homedir (void) +{ + char const *home = egetenv ("HOME"); + if (!home) + { + static char const *userenv[] = {"LOGNAME", "USER"}; + struct passwd *pw = NULL; + for (int i = 0; i < ARRAYELTS (userenv); i++) + { + char *user = egetenv (userenv[i]); + if (user) + { + pw = getpwnam (user); + if (pw) + break; + } + } + if (!pw) + pw = getpwuid (getuid ()); + if (pw) + home = pw->pw_dir; + if (!home) + return ""; + } + if (IS_ABSOLUTE_FILE_NAME (home)) + return home; + if (!emacs_wd) + error ("$HOME is relative to unknown directory"); + static char *ahome; + static ptrdiff_t ahomesize; + ptrdiff_t ahomelenbound = strlen (emacs_wd) + 1 + strlen (home) + 1; + if (ahomesize <= ahomelenbound) + ahome = xpalloc (ahome, &ahomesize, ahomelenbound + 1 - ahomesize, -1, 1); + splice_dir_file (ahome, emacs_wd, home); + return ahome; +} + +/* If /~ or // appears, discard everything through first slash. */ static char * search_embedded_absfilename (char *nm, char *endp) { diff --git a/src/lisp.h b/src/lisp.h index f8ffb33a64..7e7dba631f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4061,6 +4061,8 @@ extern void syms_of_marker (void); /* Defined in fileio.c. */ +extern char *splice_dir_file (char *, char const *, char const *); +extern char const *get_homedir (void); extern Lisp_Object expand_and_dir_to_file (Lisp_Object); extern Lisp_Object write_region (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, @@ -4185,6 +4187,7 @@ extern void syms_of_frame (void); /* Defined in emacs.c. */ extern char **initial_argv; extern int initial_argc; +extern char const *emacs_wd; #if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) extern bool display_arg; #endif diff --git a/src/xrdb.c b/src/xrdb.c index 4abf1ad84e..87c2faf659 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -202,35 +202,6 @@ magic_db (const char *string, ptrdiff_t string_len, const char *class, } -static char * -gethomedir (void) -{ - struct passwd *pw; - char *ptr; - char *copy; - - if ((ptr = getenv ("HOME")) == NULL) - { - if ((ptr = getenv ("LOGNAME")) != NULL - || (ptr = getenv ("USER")) != NULL) - pw = getpwnam (ptr); - else - pw = getpwuid (getuid ()); - - if (pw) - ptr = pw->pw_dir; - } - - if (ptr == NULL) - return xstrdup ("/"); - - ptrdiff_t len = strlen (ptr); - copy = xmalloc (len + 2); - strcpy (copy + len, "/"); - return memcpy (copy, ptr, len); -} - - /* Find the first element of SEARCH_PATH which exists and is readable, after expanding the %-escapes. Return 0 if we didn't find any, and the path name of the one we found otherwise. */ @@ -316,12 +287,11 @@ get_user_app (const char *class) if (! db) { /* Check in the home directory. This is a bit of a hack; let's - hope one's home directory doesn't contain any %-escapes. */ - char *home = gethomedir (); + hope one's home directory doesn't contain ':' or '%'. */ + char const *home = get_homedir (); db = search_magic_path (home, class, "%L/%N"); if (! db) db = search_magic_path (home, class, "%N"); - xfree (home); } return db; @@ -346,10 +316,9 @@ get_user_db (Display *display) else { /* Use ~/.Xdefaults. */ - char *home = gethomedir (); - ptrdiff_t homelen = strlen (home); - char *filename = xrealloc (home, homelen + sizeof xdefaults); - strcpy (filename + homelen, xdefaults); + char const *home = get_homedir (); + char *filename = xmalloc (strlen (home) + 1 + sizeof xdefaults); + splice_dir_file (filename, home, xdefaults); db = XrmGetFileDatabase (filename); xfree (filename); } @@ -380,13 +349,12 @@ get_environ_db (void) if (STRINGP (system_name)) { /* Use ~/.Xdefaults-HOSTNAME. */ - char *home = gethomedir (); - ptrdiff_t homelen = strlen (home); - ptrdiff_t filenamesize = (homelen + sizeof xdefaults - + 1 + SBYTES (system_name)); - p = filename = xrealloc (home, filenamesize); - lispstpcpy (stpcpy (stpcpy (filename + homelen, xdefaults), "-"), - system_name); + char const *home = get_homedir (); + p = filename = xmalloc (strlen (home) + 1 + sizeof xdefaults + + 1 + SBYTES (system_name)); + char *e = splice_dir_file (p, home, xdefaults); + *e++ = '/'; + lispstpcpy (e, system_name); } } diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 5d12685fa1..b7b78bbda0 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -95,3 +95,11 @@ fileio-tests--symlink-failure (should (equal (file-name-as-directory "d:/abc/") "d:/abc/")) (should (equal (file-name-as-directory "D:\\abc/") "d:/abc/")) (should (equal (file-name-as-directory "D:/abc//") "d:/abc//"))) + +(ert-deftest fileio-tests--relative-HOME () + "Test that expand-file-name works even when HOME is relative." + (let ((old-home (getenv "HOME"))) + (setenv "HOME" "a/b/c") + (should (equal (expand-file-name "~/foo") + (expand-file-name "a/b/c/foo"))) + (setenv "HOME" old-home))) -- 2.19.1 --------------A7FA930FA132123BB3B16DA0-- ------------=_1542133622-23408-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 4 Nov 2018 10:55:14 +0000 Received: from localhost ([127.0.0.1]:33378 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJG3m-0004cy-1Y for submit@debbugs.gnu.org; Sun, 04 Nov 2018 05:55:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:48822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gJG3k-0004ck-Mq for submit@debbugs.gnu.org; Sun, 04 Nov 2018 05:55:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJG3e-0005FP-1Q for submit@debbugs.gnu.org; Sun, 04 Nov 2018 05:55:07 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52933) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gJG3d-0005FL-UB for submit@debbugs.gnu.org; Sun, 04 Nov 2018 05:55:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJG3c-0004mC-H0 for bug-gnu-emacs@gnu.org; Sun, 04 Nov 2018 05:55:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJG3a-0005AQ-Rv for bug-gnu-emacs@gnu.org; Sun, 04 Nov 2018 05:55:04 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:36129) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gJG3a-00056N-Dh for bug-gnu-emacs@gnu.org; Sun, 04 Nov 2018 05:55:02 -0500 Received: by mail-wr1-x431.google.com with SMTP id z13-v6so3919387wrs.3 for ; Sun, 04 Nov 2018 02:55:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=0bLVJOSwcV+yBLHBI0ee3LUu+0LC1kwB7VdgSSxoOl4=; b=tYc6692oYFvO+S+HGByjZIUgMapGVi6EUhZJ7DI5Etou78mSohGMPMsZiSwek8eIWK hvDM5YAWWgjkq1g/CoPzE9lLMmHTeb1fcoSm+ziic17b4aRE9RVq8gaZXkgoGoH/idhv qiNJyCaomcPKqU7Xa7MXmt2v2Nue4cxbOKbriLfer7+NztV2kYZfGfWzgX4nkQTj3r0V JsMF7R2QzGMtdlpdJRI6OlEnAIWnyfPMEDGtqys1X8vmrs1aqTLG2LEpwlp3epR6+Fa8 BLBW0FDh06K1oqLsxcfyk4JaMLbSDjQgUMFh6RTnhBNNCA6NVNUXCA4HZymzZZnpBD0R fG/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=0bLVJOSwcV+yBLHBI0ee3LUu+0LC1kwB7VdgSSxoOl4=; b=TBVQLN4CLLLAF0K0rdZT8wKzcOMMnd49Tkv2KePUWaVBIpIGYR3Dhb1ok4ZVVOfVtx uuGevPz3DJ2tlRVBdc327PBGBGbvRDpPlOqp7ih96qPoyFj91sksHAv4o3dFVT8WFa72 QtzyDvGp7AY6EqZu93oNUJMynAzSxsymWiaU8No5tENrlAHjaKGMaZExWLjlMkIPD3PX Y1D1V0CXvrzou8P6AA5jEjD9GG/WqTGcIMe9ohDUOPk+OI2Hjqg0TsUH9WRZG307NYKw X9/m/1Xir4IyDKUNB+ZErlmeUFuaWbT/AUW6J3WdiOrKtczk//U6bq4IHPwDtk7Ab1Ua oTGw== X-Gm-Message-State: AGRZ1gK4SRRc+JenwAdNd83G5EMxaZ6zcxI/OPr3+8TAS4su6c52Jd4J VG+VHRZQvAmqcZDW2RpAQiQr6uFgt3uMZ0sHl4dzFTN0 X-Google-Smtp-Source: AJdET5exb/0A96twxBCZ41dGZpZxZkU6L89x1byfGoC9WqExM5LbFp4noHX55CWNl6U/6SRYxPQHYJnArVx3uNGQhC0= X-Received: by 2002:a5d:40cc:: with SMTP id b12-v6mr16958521wrq.133.1541328900434; Sun, 04 Nov 2018 02:55:00 -0800 (PST) MIME-Version: 1.0 From: immerrr again Date: Sun, 4 Nov 2018 11:54:49 +0100 Message-ID: Subject: 27.0.50; expand-file-name: default directory expanded twice if relative To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit 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: -5.0 (-----) I have recently tried to play with a clean .emacs.d directory by setting HOME=clean/home/dir, but faced an error coming from deep inside package-install. The error boils down to the fact that `expand-file-name' for some reason doubles the `default-directory' prefix when it is relative: $ emacs -Q -batch --eval '(let ((default-directory "DEFAULT-DIR/")) (print (expand-file-name "EXPANDED-DIR/")))' "DEFAULT-DIR/DEFAULT-DIR/EXPANDED-DIR/" Interestingly, if you run `expand-file-name' twice you end up with four prefixes: $ emacs -Q -batch --eval '(let ((default-directory "DEFAULT-DIR/")) (print (expand-file-name (expand-file-name "EXPANDED-DIR/"))))' "DEFAULT-DIR/DEFAULT-DIR/DEFAULT-DIR/DEFAULT-DIR/EXPANDED-DIR/" I couldn't find any requirement for DEFAULT-DIRECTORY parameter or `default-directory' variable to be absolute, so I would assume this is a bug in expand-file-name. In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2018-07-09 built on mmrcomp Repository revision: 3307353e13a9226d477c9b1a39baae76584b90b9 Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 System Description: Ubuntu 16.04.5 LTS Recent messages: Mark set Saving file /home/immerrr/.cask/cask-cli.el... Wrote /home/immerrr/.cask/cask-cli.el Saving file /home/immerrr/.cask/cask-cli.el... Wrote /home/immerrr/.cask/cask-cli.el Saving file /home/immerrr/.cask/cask-cli.el... Wrote /home/immerrr/.cask/cask-cli.el Saving file /home/immerrr/.cask/cask-cli.el... Wrote /home/immerrr/.cask/cask-cli.el Mark set Configured using: 'configure --prefix=/home/immerrr/.local' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 THREADS JSON LCMS2 Important settings: value of $LC_TIME: en_GB.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: el Minor modes in effect: magit-auto-revert-mode: t auto-revert-mode: t global-git-commit-mode: t async-bytecomp-package-mode: t global-undo-tree-mode: t undo-tree-mode: t diff-auto-refine-mode: t nameless-mode: t guide-key-mode: t whitespace-mode: t flycheck-mode: t shell-dirtrack-mode: t counsel-projectile-mode: t projectile-mode: t ivy-mode: t global-company-mode: t company-mode: t pyvenv-mode: t paredit-mode: t auto-compile-on-save-mode: t auto-compile-mode: t recentf-mode: t yas-global-mode: t yas-minor-mode: t save-place-mode: t show-paren-mode: t global-display-line-numbers-mode: t display-line-numbers-mode: t override-global-mode: t bar-cursor-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t size-indication-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /home/immerrr/.emacs.d/elpa/ample-regexps-20151023.300/init-tryout hides /home/immerrr/.emacs.d/elpa/lua-mode-20180104.626/init-tryout Features: (shadow sort mail-extr emacsbug sendmail macrostep-c cmacexp macrostep cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs ielm tar-mode git-rebase rect bug-reference py-isort executable vc vc-dispatcher magit-bookmark magit-obsolete magit-blame magit-stash magit-bisect magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-branch magit-collab ghub url-auth magit-files magit-refs magit-status magit dired-x magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode magit-core magit-autorevert autorevert filenotify magit-process magit-margin magit-mode git-commit magit-git magit-section magit-utils ido crm magit-popup log-edit message rfc822 mml mml-sec epa epg gnus-util rmail rmail-loaddefs mailabbrev gmm-utils mailheader pcvs-util add-log with-editor term ehelp esh-var esh-cmd esh-opt esh-io esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode async-bytecomp async server imenu undo-tree diff edebug network-stream puny nsm rmc company-jedi jedi-core epc ctable concurrent cap-words superword subword pipenv f eieio-opt speedbar sb-image ezimage dframe warnings pulse cl-print debug vc-git diff-mode bookmark pp company-elisp nameless guide-key popwin face-remap disp-table whitespace flycheck find-func rx jka-compr let-alist colir mmr-org-settings python tramp-sh tramp trampver tramp-compat tramp-loaddefs ucs-normalize shell pcomplete parse-time format-spec counsel-projectile projectile skeleton ibuf-macs wgrep grep ibuf-ext ibuffer ibuffer-loaddefs counsel dired dired-loaddefs compile esh-util swiper ivy-rich ivy delsel ivy-overlay ffap thingatpt traad virtualenvwrapper gud comint ansi-color s request-deferred request mail-utils url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap popup python-environment deferred subr-x company-oddmuse company-keywords company-etags etags xref project company-gtags company-dabbrev-code company-dabbrev company-files company-capf company-cmake company-xcode company-clang company-semantic company-eclim company-template company-css company-nxml company-bbdb company pyvenv paredit auto-compile packed recentf tree-widget wid-edit yasnippet derived elec-pair saveplace hydra ring lv paren solarized-dark-theme solarized-theme solarized color dash display-line-numbers mmr-dir-local-env mmr-bootstrap quelpa-use-package cl-extra advice pcase quelpa mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr help-fns radix-tree help-mode package-recipe-mode edmacro kmacro package-build-badges package-build lisp-mnt use-package use-package-ensure use-package-delight use-package-diminish use-package-bind-key use-package-core bind-key diminish cl linum-ex bar-cursor easy-mmode mmr-minimal mmr-ediff windmove time-date mule-util info finder-inf package easymenu epg-config url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 1357726 145867) (symbols 48 50837 2) (miscs 40 6306 4056) (strings 32 121140 10207) (string-bytes 1 4278168) (vectors 16 68224) (vector-slots 8 1809895 106986) (floats 8 422 1779) (intervals 56 116849 2490) (buffers 992 53) (heap 1024 76825 5884)) ------------=_1542133622-23408-1-- From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Nov 2018 20:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 33255@debbugs.gnu.org, immerrr@gmail.com Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.15421400001014 (code B ref 33255); Tue, 13 Nov 2018 20:14:01 +0000 Received: (at 33255) by debbugs.gnu.org; 13 Nov 2018 20:13:20 +0000 Received: from localhost ([127.0.0.1]:50650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMf3o-0000GI-AI for submit@debbugs.gnu.org; Tue, 13 Nov 2018 15:13:20 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46854) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMf3m-0000G6-Nv for 33255@debbugs.gnu.org; Tue, 13 Nov 2018 15:13:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMf3c-0001Xg-Gs for 33255@debbugs.gnu.org; Tue, 13 Nov 2018 15:13:13 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMf3b-0001Wy-0R; Tue, 13 Nov 2018 15:13:07 -0500 Received: from [176.228.60.248] (port=3913 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gMf3a-0004Tz-5M; Tue, 13 Nov 2018 15:13:06 -0500 Date: Tue, 13 Nov 2018 22:12:59 +0200 Message-Id: <83d0r891o4.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Paul Eggert on Tue, 13 Nov 2018 10:26:43 -0800) References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) 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: -6.0 (------) > From: Paul Eggert > Date: Tue, 13 Nov 2018 10:26:43 -0800 > Cc: 33255-done@debbugs.gnu.org, immerrr again , > Noam Postavsky > > > I think a non-absolute HOME is a user error. > > Eg cd $HOME may then not be idempotent. > That's true. However, POSIX says that sh treats ~/foo like $HOME/foo > even when HOME is not absolute, and it's better if Emacs is consistent > with POSIX as much as possible within the Emacs constraint that > expand-file-name must expand to an absolute file name. So I implemented > something along the line of Noam's suggestion by installing the attached > patch into master; this should fix the bug originally reported. > > Unlike Noam's suggestion, this patch causes Emacs to look at the current > value of HOME, not the value HOME had when Emacs started up, as that > corresponds more closely to POSIX sh. Thanks. I think this needs to be called out in NEWS as an incompatible change, and probably also documented in the manuals. From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Nov 2018 18:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 33255@debbugs.gnu.org, immerrr again , Noam Postavsky Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.154221906326355 (code B ref 33255); Wed, 14 Nov 2018 18:12:02 +0000 Received: (at 33255) by debbugs.gnu.org; 14 Nov 2018 18:11:03 +0000 Received: from localhost ([127.0.0.1]:52497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMzd1-0006r1-4l for submit@debbugs.gnu.org; Wed, 14 Nov 2018 13:11:03 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMzcz-0006qW-OE for 33255@debbugs.gnu.org; Wed, 14 Nov 2018 13:11:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMzct-0000gJ-Jc for 33255@debbugs.gnu.org; Wed, 14 Nov 2018 13:10:56 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMzcm-0000Gm-3k; Wed, 14 Nov 2018 13:10:48 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1gMzcj-0000Qc-0q; Wed, 14 Nov 2018 13:10:45 -0500 From: Glenn Morris References: X-Spook: plutonium Help anarchy Collapse Majic Brown out DDOS X-Ran: /0knMwq#NvK`wq;Rboff]8C-@S7-(coFFohH?SQ;@+1P^M^XK~.hBkTQED8_=3,v%+v}Jj X-Hue: blue X-Attribution: GM Date: Wed, 14 Nov 2018 13:10:44 -0500 In-Reply-To: (Paul Eggert's message of "Tue, 13 Nov 2018 10:26:43 -0800") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) 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: -6.0 (------) Paul Eggert wrote: > However, POSIX says that sh treats ~/foo like $HOME/foo even when HOME > is not absolute [...] Can you point me to the citation for that please (I'm not doubting you, just interested to read the wording, which I could not find). I'm a bit disappointed to see that a relative HOME is now documented in the Emacs manuals, since IMO it lends legitimacy to a questionable usage. I don't see it mentioned in eg the bash manual. I also don't see why it is in NEWS since it is described as a bug fix, and those aren't normally mentioned. From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Nov 2018 18:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 33255@debbugs.gnu.org, immerrr again , Noam Postavsky Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.154221949027056 (code B ref 33255); Wed, 14 Nov 2018 18:19:01 +0000 Received: (at 33255) by debbugs.gnu.org; 14 Nov 2018 18:18:10 +0000 Received: from localhost ([127.0.0.1]:52508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMzju-00072K-8e for submit@debbugs.gnu.org; Wed, 14 Nov 2018 13:18:10 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:55026) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMzjr-000726-Uq for 33255@debbugs.gnu.org; Wed, 14 Nov 2018 13:18:08 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4F4981600F7; Wed, 14 Nov 2018 10:18:02 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 3koSo1oyNgaV; Wed, 14 Nov 2018 10:18:00 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 128C6160117; Wed, 14 Nov 2018 10:18:00 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id hlr0KHvfx9Jk; Wed, 14 Nov 2018 10:17:59 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id E9D191600F7; Wed, 14 Nov 2018 10:17:59 -0800 (PST) References: From: Paul Eggert Openpgp: preference=signencrypt Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= xsFNBEyAcmQBEADAAyH2xoTu7ppG5D3a8FMZEon74dCvc4+q1XA2J2tBy2pwaTqfhpxxdGA9 Jj50UJ3PD4bSUEgN8tLZ0san47l5XTAFLi2456ciSl5m8sKaHlGdt9XmAAtmXqeZVIYX/UFS 96fDzf4xhEmm/y7LbYEPQdUdxu47xA5KhTYp5bltF3WYDz1Ygd7gx07Auwp7iw7eNvnoDTAl KAl8KYDZzbDNCQGEbpY3efZIvPdeI+FWQN4W+kghy+P6au6PrIIhYraeua7XDdb2LS1en3Ss mE3QjqfRqI/A2ue8JMwsvXe/WK38Ezs6x74iTaqI3AFH6ilAhDqpMnd/msSESNFt76DiO1ZK QMr9amVPknjfPmJISqdhgB1DlEdw34sROf6V8mZw0xfqT6PKE46LcFefzs0kbg4GORf8vjG2 Sf1tk5eU8MBiyN/bZ03bKNjNYMpODDQQwuP84kYLkX2wBxxMAhBxwbDVZud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TCqDUzYxhH/tJhbDdHrqHH767jaDaTB1+Talp/2AMKwc XNOdiklGxbmHVG6YGl6g8Lrbsu9NZEI4yLlHzuikthJWgz+3vZhVGyNlt+HNIoF6CjDL2omu 5cEq4RDHM44QqPk6l7O0pUvN1mT4B+S1b08RKpqm/ff015E37HNV/piIvJlxGAYz8PSfuGCB 1thMYqlmgdhd9/BabGFbGGYHA6U4/T5zqU+f6xHy1SsAQZ1MSKlLwekBIT+4/cLRGqCHjnV0 q5H/T6a7t5mPkbzSrOLSo4puj+IToNjYyYIDBWzhlA19avOa+rvUjmHtD3sFN7cXWtkGoi8b uNcby4U= Organization: UCLA Computer Science Department Message-ID: <0c2e43c3-82ec-5783-391d-e79549c5c1db@cs.ucla.edu> Date: Wed, 14 Nov 2018 10:17:59 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -2.3 (--) 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: -3.3 (---) On 11/14/18 10:10 AM, Glenn Morris wrote: > Can you point me to the citation for that please http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_01 > I'm a bit disappointed to see that a relative HOME is now documented > in the Emacs manuals, since IMO it lends legitimacy to a questionable > usage. I don't see it mentioned in eg the bash manual. > I also don't see why it is in NEWS since it is described as > a bug fix, and those aren't normally mentioned. My initial reaction was the same as yours, which is why my original fix didn't document the change in the manual or in NEWS. Eli felt otherwise, though. From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Nov 2018 19:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: rgm@gnu.org, immerrr@gmail.com, npostavs@gmail.com, 33255@debbugs.gnu.org Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.154222517311268 (code B ref 33255); Wed, 14 Nov 2018 19:53:02 +0000 Received: (at 33255) by debbugs.gnu.org; 14 Nov 2018 19:52:53 +0000 Received: from localhost ([127.0.0.1]:52584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gN1DZ-0002vg-GK for submit@debbugs.gnu.org; Wed, 14 Nov 2018 14:52:53 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37461) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gN1DX-0002vR-De for 33255@debbugs.gnu.org; Wed, 14 Nov 2018 14:52:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gN1DR-0005jx-HU for 33255@debbugs.gnu.org; Wed, 14 Nov 2018 14:52:46 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45183) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gN1DJ-0005gn-IZ; Wed, 14 Nov 2018 14:52:37 -0500 Received: from [176.228.60.248] (port=2402 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gN1DB-0001zc-Hd; Wed, 14 Nov 2018 14:52:35 -0500 Date: Wed, 14 Nov 2018 21:52:23 +0200 Message-Id: <83va4z77yg.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <0c2e43c3-82ec-5783-391d-e79549c5c1db@cs.ucla.edu> (message from Paul Eggert on Wed, 14 Nov 2018 10:17:59 -0800) References: <0c2e43c3-82ec-5783-391d-e79549c5c1db@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) 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: -6.0 (------) > From: Paul Eggert > Date: Wed, 14 Nov 2018 10:17:59 -0800 > Cc: 33255@debbugs.gnu.org, immerrr again , > Noam Postavsky > > > I'm a bit disappointed to see that a relative HOME is now documented > > in the Emacs manuals, since IMO it lends legitimacy to a questionable > > usage. I don't see it mentioned in eg the bash manual. > > I also don't see why it is in NEWS since it is described as > > a bug fix, and those aren't normally mentioned. > > My initial reaction was the same as yours, which is why my original fix > didn't document the change in the manual or in NEWS. Eli felt otherwise, > though. I agree that we should discourage relative $HOME, so I added text to the documentation to that effect. From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Nov 2018 19:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 33255@debbugs.gnu.org, immerrr again , Noam Postavsky Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.154274090814167 (code B ref 33255); Tue, 20 Nov 2018 19:09:02 +0000 Received: (at 33255) by debbugs.gnu.org; 20 Nov 2018 19:08:28 +0000 Received: from localhost ([127.0.0.1]:37369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gPBNr-0003gR-Vt for submit@debbugs.gnu.org; Tue, 20 Nov 2018 14:08:28 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38046) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gPBNq-0003gA-AJ for 33255@debbugs.gnu.org; Tue, 20 Nov 2018 14:08:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPBNj-0003mQ-Lg for 33255@debbugs.gnu.org; Tue, 20 Nov 2018 14:08:20 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPBNY-0003aJ-AP; Tue, 20 Nov 2018 14:08:08 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1gPBNY-00044Y-4n; Tue, 20 Nov 2018 14:08:08 -0500 From: Glenn Morris References: <0c2e43c3-82ec-5783-391d-e79549c5c1db@cs.ucla.edu> X-Spook: Plame Cartel Emergency Landing CBNRC MIT-LL Small Pox X-Ran: 70NdQG[X$yiD" (Paul Eggert's message of "Wed, 14 Nov 2018 10:17:59 -0800") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) 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: -6.0 (------) Paul Eggert wrote: > On 11/14/18 10:10 AM, Glenn Morris wrote: >> Can you point me to the citation for that please > > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_01 I had looked at that page before. Looking again, I still don't see anything as clear-cut as "POSIX says that sh treats ~/foo like $HOME/foo even when HOME is not absolute". There are no matches for "relative" on that page. There are three for "absolute". One is for ENV, and says that the results are unspecified if it is not absolute. The other two are for PWD, and say that it must be absolute. What am I missing? Just that the section on ~ expansion says nothing one way or the other? I was really looking for a reference about HOME. From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Nov 2018 19:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 33255@debbugs.gnu.org, Paul Eggert , immerrr@gmail.com, npostavs@gmail.com Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.154274107214471 (code B ref 33255); Tue, 20 Nov 2018 19:12:01 +0000 Received: (at 33255) by debbugs.gnu.org; 20 Nov 2018 19:11:12 +0000 Received: from localhost ([127.0.0.1]:37383 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gPBQW-0003lL-EN for submit@debbugs.gnu.org; Tue, 20 Nov 2018 14:11:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40035) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gPBQS-0003l4-W1 for 33255@debbugs.gnu.org; Tue, 20 Nov 2018 14:11:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPBQN-00061U-2E for 33255@debbugs.gnu.org; Tue, 20 Nov 2018 14:11:03 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57866) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPBQK-0005zY-ST; Tue, 20 Nov 2018 14:11:00 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1gPBQK-0004LK-N9; Tue, 20 Nov 2018 14:11:00 -0500 From: Glenn Morris References: <0c2e43c3-82ec-5783-391d-e79549c5c1db@cs.ucla.edu> <83va4z77yg.fsf@gnu.org> X-Spook: al-Qa'ida Brownout FTS2000 Matamoros Ansar al-Islam red X-Ran: D1R=EF?7lxSA=IG|eq[yhiMWV10|91r3#($Cx2]+wWI8R7V7eh9)Go2o:gFQ>D6OW+|)n6 X-Hue: green X-Attribution: GM Date: Tue, 20 Nov 2018 14:11:00 -0500 In-Reply-To: <83va4z77yg.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 14 Nov 2018 21:52:23 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) 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: -6.0 (------) Eli Zaretskii wrote: > I agree that we should discourage relative $HOME, so I added text to > the documentation to that effect. I really think it would be better not to mention it at all. I have never heard of it in many years of using Unix (I know this is an awful kind of statement), and see no need for it. Again, the GNU Bash manual says nothing about this. From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Nov 2018 19:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 33255@debbugs.gnu.org, eggert@cs.ucla.edu, immerrr@gmail.com, npostavs@gmail.com Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.154274201216079 (code B ref 33255); Tue, 20 Nov 2018 19:27:02 +0000 Received: (at 33255) by debbugs.gnu.org; 20 Nov 2018 19:26:52 +0000 Received: from localhost ([127.0.0.1]:37397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gPBfg-0004BG-9f for submit@debbugs.gnu.org; Tue, 20 Nov 2018 14:26:52 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gPBfe-0004B1-1F for 33255@debbugs.gnu.org; Tue, 20 Nov 2018 14:26:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPBfY-0002aq-97 for 33255@debbugs.gnu.org; Tue, 20 Nov 2018 14:26:44 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:58224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPBfE-0002MU-Cy; Tue, 20 Nov 2018 14:26:24 -0500 Received: from [176.228.60.248] (port=1645 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gPBfD-0005uU-Pi; Tue, 20 Nov 2018 14:26:24 -0500 Date: Tue, 20 Nov 2018 21:26:32 +0200 Message-Id: <83d0qzim8n.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Glenn Morris on Tue, 20 Nov 2018 14:11:00 -0500) References: <0c2e43c3-82ec-5783-391d-e79549c5c1db@cs.ucla.edu> <83va4z77yg.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) 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: -6.0 (------) > From: Glenn Morris > Cc: Paul Eggert , 33255@debbugs.gnu.org, immerrr@gmail.com, npostavs@gmail.com > Date: Tue, 20 Nov 2018 14:11:00 -0500 > > Eli Zaretskii wrote: > > > I agree that we should discourage relative $HOME, so I added text to > > the documentation to that effect. > > I really think it would be better not to mention it at all. Sorry, I disagree. We should not hide from the users what Emacs does in such corner cases. Hiding won't work anyway, because someone determined enough will find out by reading the code. We just punish those who aren't determined enough. From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Nov 2018 20:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 33255@debbugs.gnu.org, immerrr again , Noam Postavsky Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.154274667632270 (code B ref 33255); Tue, 20 Nov 2018 20:45:02 +0000 Received: (at 33255) by debbugs.gnu.org; 20 Nov 2018 20:44:36 +0000 Received: from localhost ([127.0.0.1]:37456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gPCst-0008OQ-NV for submit@debbugs.gnu.org; Tue, 20 Nov 2018 15:44:35 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:56452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gPCsq-0008OA-W3 for 33255@debbugs.gnu.org; Tue, 20 Nov 2018 15:44:33 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0E3FD1601AF; Tue, 20 Nov 2018 12:44:27 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ZPqp49Sr4QM1; Tue, 20 Nov 2018 12:44:26 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 13CCC16019B; Tue, 20 Nov 2018 12:44:26 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 7yVr3P4HDXMl; Tue, 20 Nov 2018 12:44:25 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id E980C160198; Tue, 20 Nov 2018 12:44:25 -0800 (PST) References: <0c2e43c3-82ec-5783-391d-e79549c5c1db@cs.ucla.edu> From: Paul Eggert Openpgp: preference=signencrypt Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt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khffSo8u+dwG0EgJh+te38gTcISVr0G IPplLz6YhjrbHrPRF1CN5UuL9DBGjxuN35RLNVEfta6RUFlR6NctTjvrABEBAAHCwWUEGAEC AA8FAkyAcmQCGwwFCRLMAwAACgkQ7ZfpDmKqfjSrHA/+KzAKvTxRhA9MWNLxIyJ7S5uJ16gs T3oCjZrBKGEhKMOGX4O0GA6VOEryO7QRCCYah3oxSG38IAnNeiwJXgU9Bzkk85UGbPEd7HGF /VSeHCQwWou6jqUDTSDvn9YhNTdG0KXPM74aC+xr2Zow1O2mhXihgWKD0Dw+0LYPnUOsQ0KO FxHXXYHmRrS1OZPU59BLvc+TRhIhafSHKLwbXK+6ckkxBx6h8z5ccpG0Qs4bFhdFYnFrEieD LoGmnE2YLhdV6swJ9VNCS6pLiEohT3fm7aXm15tZOIyzMZhHRSAPblXxQ0ZSWjq8oRrcYNFx c4W1URpAkBCOYJoXvQfD5L3lqAl8TCqDUzYxhH/tJhbDdHrqHH767jaDaTB1+Talp/2AMKwc XNOdiklGxbmHVG6YGl6g8Lrbsu9NZEI4yLlHzuikthJWgz+3vZhVGyNlt+HNIoF6CjDL2omu 5cEq4RDHM44QqPk6l7O0pUvN1mT4B+S1b08RKpqm/ff015E37HNV/piIvJlxGAYz8PSfuGCB 1thMYqlmgdhd9/BabGFbGGYHA6U4/T5zqU+f6xHy1SsAQZ1MSKlLwekBIT+4/cLRGqCHjnV0 q5H/T6a7t5mPkbzSrOLSo4puj+IToNjYyYIDBWzhlA19avOa+rvUjmHtD3sFN7cXWtkGoi8b uNcby4U= Organization: UCLA Computer Science Department Message-ID: <106aab5d-7910-3021-03a1-e4e5d910d831@cs.ucla.edu> Date: Tue, 20 Nov 2018 12:44:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -2.3 (--) 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: -3.3 (---) On 11/20/18 11:08 AM, Glenn Morris wrote: >> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_01 > I had looked at that page before. Looking again, I still don't see > anything as clear-cut as "POSIX says that sh treats ~/foo like $HOME/foo > even when HOME is not absolute". It needs to be read in context. Section 2.6.1 is about tilde expansion in the shell, e.g., how to treat commands like this: cd ~eggert/xxx cd ~/yyy 2.6.1 says "If the login name is null (that is, the tilde-prefix contains only the tilde), the tilde-prefix is replaced by the value of the variable /HOME."/ This is talking about the second "echo" example which uses a null login name, and it means that the second example is treated like this: cd "$HOME"/yyy/ / (The quotes are because of the last sentence in that section of the spec.) This occurs regardless of whether $HOME starts with /"/".// / From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Nov 2018 18:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 33255@debbugs.gnu.org, immerrr again , Noam Postavsky Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.154291113719580 (code B ref 33255); Thu, 22 Nov 2018 18:26:01 +0000 Received: (at 33255) by debbugs.gnu.org; 22 Nov 2018 18:25:37 +0000 Received: from localhost ([127.0.0.1]:42636 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gPtfV-00055k-62 for submit@debbugs.gnu.org; Thu, 22 Nov 2018 13:25:37 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41922) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gPtfU-00055X-DS for 33255@debbugs.gnu.org; Thu, 22 Nov 2018 13:25:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPtfN-0000fI-G3 for 33255@debbugs.gnu.org; Thu, 22 Nov 2018 13:25:31 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53159) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPtfE-0000St-M7; Thu, 22 Nov 2018 13:25:20 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1gPtfE-0004lk-JK; Thu, 22 Nov 2018 13:25:20 -0500 From: Glenn Morris References: <0c2e43c3-82ec-5783-391d-e79549c5c1db@cs.ucla.edu> <106aab5d-7910-3021-03a1-e4e5d910d831@cs.ucla.edu> X-Spook: Crypto AG Tsunami Warning Center FIPS140 Osama Avalanche X-Ran: xT*co!2BFO"3@Zp{;K,*e8+dwT7yPA7?9X#J8Qbo8|+woO>l!ISAvp6Ga>d?eD+QZtH=9' X-Hue: magenta X-Attribution: GM Date: Thu, 22 Nov 2018 13:25:20 -0500 In-Reply-To: <106aab5d-7910-3021-03a1-e4e5d910d831@cs.ucla.edu> (Paul Eggert's message of "Tue, 20 Nov 2018 12:44:25 -0800") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) 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: -6.0 (------) Paul Eggert wrote: > It needs to be read in context. Section 2.6.1 is about tilde expansion > in the shell, e.g., how to treat commands like this: > > cd ~eggert/xxx > cd ~/yyy > > 2.6.1 says "If the login name is null (that is, the tilde-prefix > contains only the tilde), the tilde-prefix is replaced by the value of > the variable /HOME."/ This is talking about the second "echo" example > which uses a null login name, and it means that the second example is > treated like this: > > cd "$HOME"/yyy/ This seems to be telling me what tilde expansion is. I am at this point looking for any documentation (not even from POSIX, any shell or frankly any Unix utility will do) that says "HOME need not be absolute, if not, here's how that is handled". So far all I see from POSIX is that it doesn't say anything about whether HOME is absolute or not. From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Nov 2018 20:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 33255@debbugs.gnu.org, immerrr again , Noam Postavsky Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.154300455129137 (code B ref 33255); Fri, 23 Nov 2018 20:23:02 +0000 Received: (at 33255) by debbugs.gnu.org; 23 Nov 2018 20:22:31 +0000 Received: from localhost ([127.0.0.1]:44596 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gQHyA-0007Zs-QF for submit@debbugs.gnu.org; Fri, 23 Nov 2018 15:22:31 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:47114) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gQHy6-0007Zd-Kf for 33255@debbugs.gnu.org; Fri, 23 Nov 2018 15:22:27 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6F4DA160198; Fri, 23 Nov 2018 12:22:20 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Sm5YPU1ny_Jq; Fri, 23 Nov 2018 12:22:19 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B996B160162; Fri, 23 Nov 2018 12:22:19 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id CpfsY80aZlLj; Fri, 23 Nov 2018 12:22:19 -0800 (PST) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 86D781600DE; Fri, 23 Nov 2018 12:22:19 -0800 (PST) References: <0c2e43c3-82ec-5783-391d-e79549c5c1db@cs.ucla.edu> <106aab5d-7910-3021-03a1-e4e5d910d831@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Fri, 23 Nov 2018 12:22:19 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) 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: -3.3 (---) Glenn Morris wrote: > So far all I see from POSIX is that it doesn't say anything about whether HOME is absolute or not. By not saying anything POSIX gives permission to the application to set HOME to a relative name. When POSIX intends the requirement that an environment variable's value must be absolute (e.g., PWD), it says so. When it doesn't intend such a requirement (e.g., HOME, PATH, SHELL, TMPDIR) it says nothing. From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Nov 2018 05:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: 33255@debbugs.gnu.org, immerrr again , Noam Postavsky Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.15432973555596 (code B ref 33255); Tue, 27 Nov 2018 05:43:02 +0000 Received: (at 33255) by debbugs.gnu.org; 27 Nov 2018 05:42:35 +0000 Received: from localhost ([127.0.0.1]:50349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRW8p-0001SB-GZ for submit@debbugs.gnu.org; Tue, 27 Nov 2018 00:42:35 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRW8o-0001Ry-9x for 33255@debbugs.gnu.org; Tue, 27 Nov 2018 00:42:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRW8i-0008J1-Aj for 33255@debbugs.gnu.org; Tue, 27 Nov 2018 00:42:28 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37022) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRW8Z-0008FU-0o; Tue, 27 Nov 2018 00:42:19 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1gRW8W-00018Q-Cy; Tue, 27 Nov 2018 00:42:16 -0500 From: Glenn Morris References: <0c2e43c3-82ec-5783-391d-e79549c5c1db@cs.ucla.edu> <106aab5d-7910-3021-03a1-e4e5d910d831@cs.ucla.edu> X-Spook: Trojan FEMA lock picking colonel ammunition Syria Bin X-Ran: #3I+&WCB=OA}zk{cB,5@_TH?TsG2^;}:p5:3ndt_usEyyQC%WpX3eH*-aHN@F^4Dff.I`p X-Hue: brightyellow X-Attribution: GM Date: Tue, 27 Nov 2018 00:42:16 -0500 In-Reply-To: (Paul Eggert's message of "Fri, 23 Nov 2018 12:22:19 -0800") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) 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: -6.0 (------) Paul Eggert wrote: > By not saying anything POSIX gives permission to the application to > set HOME to a relative name. When POSIX intends the requirement that > an environment variable's value must be absolute (e.g., PWD), it says > so. When it doesn't intend such a requirement (e.g., HOME, PATH, > SHELL, TMPDIR) it says nothing. So the justification for implementing this is indeed "it's not explicitly forbidden". Here's an example of how this can be confusing: cd /tmp mkdir foo echo hi > foo/bar HOME=foo emacs C-x C-f ~/bar ; works M-: (shell-command "ls ~/bar") ; fails So, Emacs and external processes it spawns interpret ~ differently; ie external processes are likely to fail in odd ways. All this would be avoided if the user had just said HOME=$PWD/foo to start with. >> I am at this point looking for any documentation (not even from POSIX, >> any shell or frankly any Unix utility will do) that says "HOME need >> not be absolute, if not, here's how that is handled". AFAICS Emacs is the only thing documenting this scenario. From unknown Thu Sep 11 20:48:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#33255: 27.0.50; expand-file-name: default directory expanded twice if relative Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Nov 2018 18:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33255 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 33255@debbugs.gnu.org, immerrr again , Noam Postavsky Received: via spool by 33255-submit@debbugs.gnu.org id=B33255.15433423087191 (code B ref 33255); Tue, 27 Nov 2018 18:12:01 +0000 Received: (at 33255) by debbugs.gnu.org; 27 Nov 2018 18:11:48 +0000 Received: from localhost ([127.0.0.1]:52504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRhps-0001rv-FV for submit@debbugs.gnu.org; Tue, 27 Nov 2018 13:11:48 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:40912) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRhpo-0001rg-I6 for 33255@debbugs.gnu.org; Tue, 27 Nov 2018 13:11:45 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9D52216049A; Tue, 27 Nov 2018 10:11:38 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id bhj2Y6ZW51_q; Tue, 27 Nov 2018 10:11:37 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D37431604E7; Tue, 27 Nov 2018 10:11:37 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id aW8fqu5p-lfx; Tue, 27 Nov 2018 10:11:37 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id B744A16049A; Tue, 27 Nov 2018 10:11:37 -0800 (PST) References: <0c2e43c3-82ec-5783-391d-e79549c5c1db@cs.ucla.edu> <106aab5d-7910-3021-03a1-e4e5d910d831@cs.ucla.edu> From: Paul Eggert Openpgp: preference=signencrypt Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= xsFNBEyAcmQBEADAAyH2xoTu7ppG5D3a8FMZEon74dCvc4+q1XA2J2tBy2pwaTqfhpxxdGA9 Jj50UJ3PD4bSUEgN8tLZ0san47l5XTAFLi2456ciSl5m8sKaHlGdt9XmAAtmXqeZVIYX/UFS 96fDzf4xhEmm/y7LbYEPQdUdxu47xA5KhTYp5bltF3WYDz1Ygd7gx07Auwp7iw7eNvnoDTAl KAl8KYDZzbDNCQGEbpY3efZIvPdeI+FWQN4W+kghy+P6au6PrIIhYraeua7XDdb2LS1en3Ss mE3QjqfRqI/A2ue8JMwsvXe/WK38Ezs6x74iTaqI3AFH6ilAhDqpMnd/msSESNFt76DiO1ZK QMr9amVPknjfPmJISqdhgB1DlEdw34sROf6V8mZw0xfqT6PKE46LcFefzs0kbg4GORf8vjG2 Sf1tk5eU8MBiyN/bZ03bKNjNYMpODDQQwuP84kYLkX2wBxxMAhBxwbDVZudzxDZJ1C2VXujC OJVxq2kljBM9ETYuUGqd75AW2LXrLw6+MuIsHFAYAgRr7+KcwDgBAfwhPBYX34nSSiHlmLC+ KaHLeCLF5ZI2vKm3HEeCTtlOg7xZEONgwzL+fdKo+D6SoC8RRxJKs8a3sVfI4t6CnrQzvJbB n6gxdgCu5i29J1QCYrCYvql2UyFPA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qlmgdhd9/BabGFbGGYHA6U4/T5zqU+f6xHy1SsAQZ1MSKlLwekBIT+4/cLRGqCHjnV0 q5H/T6a7t5mPkbzSrOLSo4puj+IToNjYyYIDBWzhlA19avOa+rvUjmHtD3sFN7cXWtkGoi8b uNcby4U= Organization: UCLA Computer Science Department Message-ID: <7f6d9f6d-5aad-ddac-fef3-d6dce259e57c@cs.ucla.edu> Date: Tue, 27 Nov 2018 10:11:34 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -2.3 (--) 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: -3.3 (---) On 11/26/18 9:42 PM, Glenn Morris wrote: > Here's an example of how this can be confusing: > > cd /tmp > mkdir foo > echo hi > foo/bar > HOME=foo emacs > C-x C-f ~/bar ; works > M-: (shell-command "ls ~/bar") ; fails Yes, and there's a similar confusion in ordinary POSIX shells: $ cd /tmp $ mkdir foo $ echo hi > foo/bar $ HOME=foo sh $ cat ~/bar hi $ cd $ cat ~/bar cat: foo/bar: No such file or directory The moral of this story in POSIX is "Don't set HOME to a relative file name, as it's trouble for any application that chdirs." In your example Emacs chdirs; in mine, sh chdirs. The question is whether Emacs should attempt to insulate users from this trouble, presumably by replacing HOME with an absolute directory name when HOME's value is relative (or is absent or empty, for that matter). The POSIX shell doesn't do that, which is an argument for Emacs not doing it either.