Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-29 Thread Страхиња Радић
On 23/10/29 08:49PM, Markus Wichmann wrote:
> Am Sun, Oct 29, 2023 at 06:00:18PM +0100 schrieb Страхиња Радић:
> > mkdir returning EISDIR is definitely not a part of POSIX.[1]
> >
> > [1]: 
> > https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html#tag_16_325_05
> 
> That's where you're wrong. Any function can fail for any reason unless
> POSIX specifically states "this function shall not fail with...". Only
> if the error conditions listed in the definition of the function apply,
> they have to return those error codes. Or as XSI chapter 2.3 puts it:
> 
> | Implementations may support additional errors not included in this list,
> | may generate errors included in this list under circumstances other than
> | those described here, or may contain extensions or limitations that
> | prevent some errors from occurring.

Ok, let me rephrase that:

mkdir returning EISDIR is definitely not prescribed by POSIX. The possibility 
of it being returned is not forbidden, but also not explicitly enumerated in
POSIX.


signature.asc
Description: PGP signature


Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-29 Thread Markus Wichmann
Am Sun, Oct 29, 2023 at 06:00:18PM +0100 schrieb Страхиња Радић:
> mkdir returning EISDIR is definitely not a part of POSIX.[1]
>
> [1]: 
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html#tag_16_325_05

That's where you're wrong. Any function can fail for any reason unless
POSIX specifically states "this function shall not fail with...". Only
if the error conditions listed in the definition of the function apply,
they have to return those error codes. Or as XSI chapter 2.3 puts it:

| Implementations may support additional errors not included in this list,
| may generate errors included in this list under circumstances other than
| those described here, or may contain extensions or limitations that
| prevent some errors from occurring.
|
| The ERRORS section on each reference page specifies which error
| conditions shall be detected by all implementations (``shall fail") and
| which may be optionally detected by an implementation (``may fail"). If
| no error condition is detected, the action requested shall be
| successful. If an error condition is detected, the action requested may
| have been partially performed, unless otherwise stated.

For example, execve() can fail with ENOENT even though the file exists.
On Linux this happens when the file names an interpreter that does not
exist.

Ciao,
Markus



Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-29 Thread Страхиња Радић
On 23/10/29 07:59AM, Randy Palamar wrote:
> > Plus I didn't know mkdir could fail with EISDIR. My manpage is not
> > documenting that case.
> 
> It's probably legacy nonsense or from some obscure platform that I
> noticed when checking other implementations [0].

mkdir returning EISDIR is definitely not a part of POSIX.[1]

[1]: 
https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html#tag_16_325_05


signature.asc
Description: PGP signature


Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-29 Thread Randy Palamar
> That is one of the jobs of the -p switch to mkdir. However, without -p,
> mkdir is not allowed to ignore failure like that.

Once I looked in more detail I realized that was the case so I didn't
send the patch. It was not how I previously thought about the -p
switch though.

> Plus I didn't know mkdir could fail with EISDIR. My manpage is not
> documenting that case.

It's probably legacy nonsense or from some obscure platform that I
noticed when checking other implementations [0].

- Randy

PS It seems I will need to switch my mailer because I don't think my
other patch fixing this issue made it through. Quentin's patches
supersede it though.

[0]: https://git.busybox.net/busybox/tree/libbb/make_directory.c#n99



Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-29 Thread Rene Kita
On Sun, Oct 29, 2023 at 10:58:26AM +0100, Quentin Rameau wrote:
> I pushed a patch to hackers@, you can test it and confirm that fixes
> the issue, thanks!

Works now, thanks!



Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-29 Thread Quentin Rameau
Hi Rene,

> I can't find the patch in the mail archives, but git://git.suckless.org/sbase
> has commit ddde8021 (Simplify install/uninstall). With this commit
> trying to install gives the following result:
> 
> % make install
> scripts/mkproto install /usr/local /usr/local/share/man proto
> scripts/mkproto: 15: cannot create /usr/local/share/man: Is a directory
> scripts/install proto
> scripts/install: 5: cannot open proto: No such file
> make: *** [Makefile:221: install] Error 2
> 
> I wanted to send a patch but I don't grok the code - which I think is
> quite ironic given the commit message. So I report this as a bug.

Thank you for reporting,
I pushed a patch to hackers@, you can test it and confirm that fixes
the issue, thanks!



Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-29 Thread Markus Wichmann
Am Sat, Oct 28, 2023 at 01:48:07PM -0600 schrieb Randy Palamar:
> This is a problem with mkdir in sbase. It probably shouldn't error out
> when mkdir(3p) fails and sets errno to EEXIST or EISDIR. I'll send a
> patch to hackers@ soon.
>
> - Randy
>

That is one of the jobs of the -p switch to mkdir. However, without -p,
mkdir is not allowed to ignore failure like that.

Plus I didn't know mkdir could fail with EISDIR. My manpage is not
documenting that case.

Ciao,
Markus



Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-28 Thread Randy Palamar
> scripts/mkproto: 15: cannot create /usr/local/share/man: Is a directory

Actually, looking at it again this is just a problem in the makefile.
scripts/mkproto has too many args. Though fixing that exposes a
separate issue with the way `find` is being invoked.

- Randy



Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-28 Thread Randy Palamar
Hi,

> scripts/mkproto: 15: cannot create /usr/local/share/man: Is a directory

This is a problem with mkdir in sbase. It probably shouldn't error out
when mkdir(3p) fails and sets errno to EEXIST or EISDIR. I'll send a
patch to hackers@ soon.

- Randy



[dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-28 Thread Rene Kita
I can't find the patch in the mail archives, but git://git.suckless.org/sbase
has commit ddde8021 (Simplify install/uninstall). With this commit
trying to install gives the following result:

% make install
scripts/mkproto install /usr/local /usr/local/share/man proto
scripts/mkproto: 15: cannot create /usr/local/share/man: Is a directory
scripts/install proto
scripts/install: 5: cannot open proto: No such file
make: *** [Makefile:221: install] Error 2

I wanted to send a patch but I don't grok the code - which I think is
quite ironic given the commit message. So I report this as a bug.