in reply to Re^3: Getting the absolute path of a script, without PWD
in thread Getting the shell's version of working directory, without PWD's help
This seems to be a portability issue.
cwd()."\n" eq `pwd -L`
- holds for termux, win10
- fails for my (old) ubuntu in a VM
I'd say file a bugreport against Cwd and in the meantime resort to `pwd` or `pwd -L` on systems where it fails.
update
after further investigation, it seems that `pwd` inside Perl doesn't default like pwd in bash ... which is unexpected
lanx@ubuntu14-large:/tmp/sym$ perl -MCwd -E'say `pwd` ' /tmp/dir lanx@ubuntu14-large:/tmp/sym$ pwd /tmp/sym lanx@ubuntu14-large:/tmp/sym$ perl -MCwd -E'say `pwd -L` ' /tmp/sym lanx@ubuntu14-large:/tmp/sym$
so strictly speaking, this is not a bug in Cwd, since cwd() returns the same like `pwd` (which does not always -L )
The question is why is bash's pwd defaulting differently inside Perl?
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Getting the absolute path of a script, without PWD (bug)
by LanX (Saint) on Jul 16, 2021 at 07:50 UTC | |
by perlancar (Hermit) on Jul 16, 2021 at 07:52 UTC | |
by LanX (Saint) on Jul 16, 2021 at 08:01 UTC | |
by perlancar (Hermit) on Jul 16, 2021 at 10:30 UTC | |
by LanX (Saint) on Jul 16, 2021 at 10:43 UTC | |
Re^5: Getting the absolute path of a script, without PWD (bug?)(update)
by perlancar (Hermit) on Jul 16, 2021 at 07:51 UTC | |
by choroba (Cardinal) on Jul 16, 2021 at 08:52 UTC | |
by perlancar (Hermit) on Jul 16, 2021 at 10:20 UTC |
In Section
Seekers of Perl Wisdom