Yeah, exactly. Thanks for this very interesting discussion. Bye

On Thursday, October 26, 2023, Gabriel Ravier <gabrav...@gmail.com> wrote:

> On 10/26/23 11:55, Oğuz wrote:
>
>> On Wed, Oct 25, 2023 at 9:47 PM Gabriel Ravier <gabrav...@gmail.com>
>> wrote:
>> > Isn't this a similar situation to e.g. `getuid`/`geteuid`/etc. failures
>>
>> Not similar enough to draw a conclusion. Unlike system(), those functions
>> are not part of the language defined by ISO C, but the operating system
>> interface defined by POSIX. How operating systems are designed is outside
>> the scope of ISO C; it can not require that system(NULL) perform additional
>> checks to determine if the command processor is currently available, as it
>> might require the user to enter his credentials, have a working internet
>> connection, etc. And an environment where the command shell is unavailable
>> is not supported by POSIX, so system(NULL) always returns non-zero.
>>
>> I don't think POSIX allows (or should allow) system(NULL) to return 0,
>> but feel free to request clarification.
>>
>
>
> POSIX does not allow `system(NULL)` to return 0, yes. That's very clear in
> the standard - it says as much directly. I do not see how that impacts
> behavior in a non-conforming environment - POSIX does not define the
> behavior of a non-conforming environment, does it ? (the very idea seems
> tautologically false...)
>
> I also do not see how POSIX can forbid tests that could only fail in an
> environment which does not conform to POSIX - by the very definition of
> that statement, this means `system(NULL)` will still always return non-0 in
> a POSIX-confirming environment. Those tests are not observable to any
> program executing in a POSIX-conforming environment - from the point of
> view of the standard they may as well not occur, so POSIX cannot impose
> anything upon them.
>
> (I suppose you could say that makes things needlessly slower when
> executing in a POSIX-conforming environment, but I see no requirement in
> the standard that implementations be fast)
>
>
>>
>> --
>> Oğuz
>>
>>
>

-- 
Oğuz
  • system(NULL) overly r... enh via austin-group-l at The Open Group
    • Re: system(NULL)... Oğuz via austin-group-l at The Open Group
      • Re: system(N... Jonathan Wakely via austin-group-l at The Open Group
        • Re: syst... Oğuz via austin-group-l at The Open Group
          • Re: ... Gabriel Ravier via austin-group-l at The Open Group
            • ... enh via austin-group-l at The Open Group
              • ... Gabriel Ravier via austin-group-l at The Open Group
            • ... Oğuz via austin-group-l at The Open Group
              • ... Gabriel Ravier via austin-group-l at The Open Group
                • ... Oğuz via austin-group-l at The Open Group
    • Re: system(NULL)... Robert Elz via austin-group-l at The Open Group

Reply via email to