bug-bash
[Top][All Lists]
Advanced

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

Re: [5.3-alpha] ">& /some/file" would fail when /some/file already exist


From: Chet Ramey
Subject: Re: [5.3-alpha] ">& /some/file" would fail when /some/file already exists
Date: Sun, 28 Apr 2024 13:12:20 -0400
User-agent: Mozilla Thunderbird

On 4/26/24 3:42 AM, Grisha Levit wrote:

Looks like RX_* values were previously used only to form the `flags'
argument of do_redirections() and related functions, comprising:

     RX_ACTIVE RX_UNDOABLE RX_CLEXEC


Separately, the REDIRECTION struct has a `flags' member holding O_*
flags passed to open(). But the following (other) RX_* values are also
getting stored in the `flags' member of REDIRECTION structs:

     RX_INTERNAL RX_USER RX_SAVCLEXEC RX_SAVEFD RX_EXPANDED


So as Oğuz notes, the issue here is observed when an RX_* value from
the above list has the same value as an O_* flag.

Yes, this overlap is the problem.

Perhaps it would make sense to change the latter set of RX_* values
into new REDIR_* values, which make up the `rflags' REDIRECTION member.

The rflags approach is the right one, you just need to separate the private
RX_ flag vaues from the public REDIR_  values by reserving bits.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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