Re: [hackers] [PATCH 2/2] scripts: Fix non-portable find -perm /mode

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.



Re: [hackers] [PATCH 2/2] scripts: Fix non-portable find -perm /mode

2023-10-29 Thread Quentin Rameau
> > I guess that the original intent of the code here
> > was to to find any executable file.  
> 
> I concur. It seems to me that the default output mode for `cc` is 755
> even if the parent directory has more restrictive permissions. So the
> more concise -perm -111 should suffice. I will leave the decision up
> to Roberto though.

Well, the file creation mode for the executables is 777,
with user umask applied, so could be anything really,
like absent executable bit for others.
The install script though, once executables have been identified,
changes the target file mode to 755.

I'm not fond of that method, especially that we already know
the name of target executables.
I guess I'll propose some improvement there at some point.



Re: [hackers] [PATCH 2/2] scripts: Fix non-portable find -perm /mode

2023-10-29 Thread Randy Palamar
> Not exactly, -perm -111 matches if at least the mode has executable bit
> for all (could be 751 for example),
> while GNU -perm /111 matches if any bit is set (could be 500).

Thanks for the info, I didn't really check the GNU manpage.

> I guess that the original intent of the code here
> was to to find any executable file.

I concur. It seems to me that the default output mode for `cc` is 755
even if the parent directory has more restrictive permissions. So the
more concise -perm -111 should suffice. I will leave the decision up
to Roberto though.



Re: [hackers] [PATCH 2/2] scripts: Fix non-portable find -perm /mode

2023-10-29 Thread Quentin Rameau
> Hi Quentin,

Hola Randy,

> > -find . ! -name . -prune -type f -perm /111 |
> > +find . ! -name . -prune -type f \( -perm -u+x -o -perm -g+x -o -perm o+x 
> > \) |  
> 
> I believe `-perm -111` is equivalent and specified by POSIX.

Not exactly, -perm -111 matches if at least the mode has executable bit
for all (could be 751 for example),
while GNU -perm /111 matches if any bit is set (could be 500).

I guess that the original intent of the code here
was to to find any executable file.



Re: [hackers] [PATCH 2/2] scripts: Fix non-portable find -perm /mode

2023-10-29 Thread Randy Palamar
Hi Quentin,

> -find . ! -name . -prune -type f -perm /111 |
> +find . ! -name . -prune -type f \( -perm -u+x -o -perm -g+x -o -perm o+x \) |

I believe `-perm -111` is equivalent and specified by POSIX.

- Randy



[hackers] [PATCH 2/2] scripts: Fix non-portable find -perm /mode

2023-10-29 Thread Quentin Rameau
---
 scripts/mkproto | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/mkproto b/scripts/mkproto
index ab0ade4..192fe56 100755
--- a/scripts/mkproto
+++ b/scripts/mkproto
@@ -14,7 +14,7 @@ trap "rm -f scripts/proto" EXIT INT QUIT TERM
 
 (set -e
 echo d $prefix/bin $prefix/bin 755
-find . ! -name . -prune -type f -perm /111 |
+find . ! -name . -prune -type f \( -perm -u+x -o -perm -g+x -o -perm o+x \) |
 sed "s@.*@c & $prefix/bin/& 755@"
 
 echo d $manprefix/man1 $manprefix/man1 755
-- 
2.42.0