Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s/S_IWRITE/S_IWUSR/ #4591

Merged
merged 2 commits into from
Oct 9, 2021
Merged

s/S_IWRITE/S_IWUSR/ #4591

merged 2 commits into from
Oct 9, 2021

Conversation

kmk3
Copy link
Collaborator

@kmk3 kmk3 commented Oct 5, 2021

They are equivalent, but only the latter is POSIX. See sys_stat.h(0p)
of POSIX.1-2017[1]. From Section 14.9.5, The Mode Bits for Access
Permission of the glibc manual[2]:

S_IWUSR
S_IWRITE

Write permission bit for the owner of the file.  Usually 0200.
S_IWRITE is an obsolete synonym provided for BSD compatibility.

Current usage:

$ git grep -F S_IWRITE -- src | wc -l
11
$ git grep -F S_IWUSR -- src | wc -l
26

Commands used to search and replace:

$ git grep -l -z S_IWRITE -- src | xargs -0 -I '{}' sh -c \
  "printf '%s\n' \"\`sed 's/S_IWRITE/S_IWUSR/g' '{}'\`\" >'{}'"

Note: The other related non-POSIX macros are not used anywhere:

$ git grep -F -e S_IREAD -e S_IEXEC -- src
$

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
[2] https://www.gnu.org/software/libc/manual/html_node/Permission-Bits.html


Misc: I noticed this on #4586.

Since this conflicts with #4586, I'm marking this as a draft until that is
merged.

Note to self: This will need to be rebased/reworded.

They are equivalent, but only the latter is POSIX.  See sys_stat.h(0p)
of POSIX.1-2017[1].  From Section 14.9.5, The Mode Bits for Access
Permission of the glibc manual[2]:

> S_IWUSR
> S_IWRITE
>
>     Write permission bit for the owner of the file.  Usually 0200.
>     S_IWRITE is an obsolete synonym provided for BSD compatibility.

Current usage:

    $ git grep -F S_IWRITE -- src | wc -l
    11
    $ git grep -F S_IWUSR -- src | wc -l
    26

Commands used to search and replace:

    $ git grep -l -z S_IWRITE -- src | xargs -0 -I '{}' sh -c \
      "printf '%s\n' \"\`sed 's/S_IWRITE/S_IWUSR/g' '{}'\`\" >'{}'"

Note: The other related non-POSIX macros are not used anywhere:

    $ git grep -F -e S_IREAD -e S_IEXEC -- src
    $

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
[2] https://www.gnu.org/software/libc/manual/html_node/Permission-Bits.html
@smitsohu
Copy link
Collaborator

smitsohu commented Oct 5, 2021

Since this conflicts with #4586, I'm marking this as a draft until that is
merged.

Resolved in that pull request. Looks good!

@kmk3
Copy link
Collaborator Author

kmk3 commented Oct 5, 2021

@smitsohu commented on Oct 5:

Since this conflicts with #4586, I'm marking this as a draft until that is
merged.

Resolved in that pull request.

Nice.

Looks good!

Thanks!

@netblue30 netblue30 marked this pull request as ready for review October 9, 2021 13:59
@netblue30
Copy link
Owner

All fine, the worst that can happen is to break the compilation on some old systems. I'm merging it in.

@netblue30 netblue30 merged commit 6c9e263 into netblue30:master Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To Document (RELNOTES/man)
Development

Successfully merging this pull request may close these issues.

3 participants