Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14418

cd -L not behaving as documented with symlinks and ..

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Hugo Gabriel Eyherabide <hugogabriel.eyherabide@gmail.com>
Newsgroups gnu.bash.bug
Subject cd -L not behaving as documented with symlinks and ..
Date Mon, 30 Jul 2018 14:48:09 +0300
Lines 31
Approved bug-bash@gnu.org
Message-ID <mailman.4410.1532951294.1292.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1532951295 4912 208.118.235.17 (30 Jul 2018 11:48:15 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
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=2Fl2twT/OtlprtfcMjbWJjoAM9OVbzuf9mw20lT2D78=; b=iVcyi6g5ADhakllbnusjb7abRUh1qTKRp+RFBY9n+nPeCALB57xw48T2bJRLI6MqD2 5Ffs8yPUEmdu20ghgGrZskq0JM5qEZmrqkqy4F/GJFDF74kBrFUQJCRkevXXZQAcoeBu z3tng5QonSgXYJesKp1ERCCD8WlGFGmkXLQYXbyyfECr84m8jgV3dD/cslvy0qElFupi ysK62aGn2BcxWqf/fZbHkkTu4e5btzfW4KKANWuTXloSz9o5W+yYWTXviyKkDnQBRGtM Qga6lo5gUhAnL7GWVfJaTCG9sIsscLHkFz5cE1Kemcv2UXm4y3yJ8Rr/hr/+WjG0sntR d1Cw==
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=2Fl2twT/OtlprtfcMjbWJjoAM9OVbzuf9mw20lT2D78=; b=apuiLHzcaqFixGbN/43ZwM22mwOVNHdppNWgOAqPCaAt1kqQ8hK5uCqadsKXTQqvA0 LxnNFDGvmEZNUDclSqsFR0pZTHBOoPhaEJT2RBD8vwx3hRCHDxqX/MUEisdNDqt/3QrP O2PqkFcq0VOaJzCT/zYvh3AFuy+o05bDX+8y1f+JY43zJ10WbNhu9T+8lqRyNR9HVhXI clGEcSb1G9MQ2NIC5M0RIi+0W4PLxajs8DDuC6hF4NByhdT2NGZAJE9hKi22rMZOhkyt pwY50F2INtUVUPrI41yXH8O209TNDnOB30fgpa1XrQOv4bwoad3gWlFvrwbPQSv3cKs7 2zww==
X-Gm-Message-State AOUpUlGNWBzp76408FaRC1qrSoNOgp5J1Oytz9iIZqEREawHoSujGHIr CXdYqs6c5oQ2MaJetK/0iz1vDkneLk+pCz0UqPAigSsT
X-Google-Smtp-Source AAOMgpf7ldyS4rgcfc+FUJ5GMFZYUS/7iW1V/nigK4W9IZ72aCUP2rXYzp6dBeIEJ5qcZxoUWWdyt+aVhsimkgYKZ1E=
X-Received by 2002:a37:9d54:: with SMTP id g81-v6mr14987341qke.186.1532951290080; Mon, 30 Jul 2018 04:48:10 -0700 (PDT)
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:400d:c09::22a
X-Content-Filtered-By Mailman/MimeDel 2.1.21
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14418

Show key headers only | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale$
uname output: Linux hugo-agile 4.13.0-43-generic #48~16.04.1-Ubuntu SMP Thu
May 17 12:56:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.4
Patch Level: 0
Release Status: release

Description:
According to the documentation, cd -L should resolve symlinks after
evaluating .., and that is indeed the case, unless the canonicalization
fails, in which case it uses the original path, seemingly behaving as cd -P.

More specifically, suppose that in the current working directory /tmp there
only exists a directory a/b and a symlink c->a/b. Then, cd -L c/../; pwd
produces /tmp as expected. However, cd -L c/../b; pwd results in /tmp/a/b,
as opposed to an error (because the directory /tmp/b does not exists).

I believe that pathcanon is correct, and that the problem is in
change_to_directory, when choosing between the canon and non-canon form.

Repeat-By:
See above.
Fix:

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

cd -L not behaving as documented with symlinks and .. Hugo Gabriel Eyherabide <hugogabriel.eyherabide@gmail.com> - 2018-07-30 14:48 +0300

csiph-web