coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: Change pwd to assume -L by default


From: Pádraig Brady
Subject: Re: RFC: Change pwd to assume -L by default
Date: Mon, 30 Jun 2014 10:29:03 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 06/30/2014 03:40 AM, Jim Meyering wrote:
> On Sun, Jun 29, 2014 at 9:42 AM, Pádraig Brady <address@hidden> wrote:
>> POSIX says that `pwd` without options should assume -L is specified.
>> pwd is most often invoked as a shell builtin and bash, dash, zsh, ksh
>> all follow POSIX and assume that -L is the default.
>> However coreutils pwd assumes -P is the default, according to this
>> comment in the source:
>>
>>   "POSIX requires a default of -L, but most scripts expect -P."
>>
>> I'm not sure that is correct though, since the vast majority
>> of scripts would be executing the shell builtin?
>>
>> Note also that the solaris sh builtin and separate pwd util
>> only support -P behavior.
> 
> Hi Pádraig,
> 
> When I wrote the original pwd.c, the standard was
> POSIX 1003.2-1992, and someone had actually sent
> me hard copy for Volumes 1 and 2. I've just checked (still have them)
> and see it says simply to print "an absolute pathname of the current
> working directory", so I made it call xgetcwd and print that.
> 
> I think it's fine to make -L the default, now.  As you say, it will make
> our version conform to the newer standard and eliminate a small
> source of incompatibility between the modern built-ins and exec'd
> versions of this command. Any time we make such a change, there
> is a risk of causing a script to malfunction, but I think very few scripts
> exec pwd, and fewer still would malfunction with this change.
> 
> I like the idea.

Thanks for the detail.

What got me thinking about this was a query about
realpath -sL currently not using $PWD for relative arguments.
Details at: https://bugzilla.redhat.com/1114225#1
It might be useful to change that, though I'm less sure about that one.

I'll push the attached for the pwd change later.

thanks,
Pádraig.

Attachment: pwd-L.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]