• Re: Long options, like it or not, are the future

    From Dan Espen@21:1/5 to Kaz Kylheku on Tue Jun 14 12:05:38 2022
    Kaz Kylheku <480-992-1380@kylheku.com> writes:

    The problem with --ignore-fail-on-non-empty that it's five words
    long.

    Snipped the rest of the post where you didn't even try to prove that 5
    words is a problem. As it is, the rarely used option explains itself.
    If I encountered it in a script I'd know exactly what it does.

    But more important, I've found it a good policy NOT to criticize the
    work of others until I've done better.

    --
    Dan Espen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Dan Espen on Tue Jun 14 16:50:40 2022
    On 2022-06-14, Dan Espen <dan1espen@gmail.com> wrote:
    Kaz Kylheku <480-992-1380@kylheku.com> writes:

    The problem with --ignore-fail-on-non-empty that it's five words
    long.

    Snipped the rest of the post where you didn't even try to prove that 5
    words is a problem. As it is, the rarely used option explains itself.

    It doesn't explain itself.

    If I encountered it in a script I'd know exactly what it does.

    I had to look it up and experiment with it, and also rely on other documentation (POSIX). My first blind guess was: does it actually delete
    the nonempty directory, like rm -r? But no, that couldn't be it;
    that's significantly more than what "ignore" means.

    So my next suspicion was: ok, so if ignoring that situation is
    not the default behavior, it might be that rmdir *heeds* the situation
    somehow. Maybe it's deleting the directories in left-to-right
    order and then failing on the first nonempty directory,
    so the rest are unprocessed.

    But in fact, ignore just means "ignore for the purposes of calculating
    the termination status", not for the purposes of any action.

    To be sure about this, I had to experiment. Neither the man nor the info
    page explains what it means to ignore or not to ignore the error.
    Before that, I also looked at the POSIX documentation, which which
    assures us that rmdir invokes the rmdir system call for each argument.

    The POSIX documentation also has this:

    EXIT STATUS:

    The following exit values shall be returned:

    0
    Each directory entry specified by a dir operand was removed
    successfully.
    >0
    An error occurred.

    We know that since the rmdir system call is used, ENOTEMPTY is an error;
    so we know that if one or more directories were not deleted due to not
    being empty, and all others were deleted, there will be a failed status.

    The GNU documentation says only this (in the info page, not the man
    page):

    An exit status of zero indicates success, and a nonzero value
    indicates failure.

    which is just teaching the reader how exist status works in a POSIX-like system, not what it means for this particular command.

    After looking at the POSIX documentation, I inferred that "ignore" must
    just mean mean not to to include that situation in the exit status,
    after which a quick experiment confirmed it.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Espen@21:1/5 to Kaz Kylheku on Tue Jun 14 14:08:14 2022
    Kaz Kylheku <480-992-1380@kylheku.com> writes:

    On 2022-06-14, Dan Espen <dan1espen@gmail.com> wrote:
    Kaz Kylheku <480-992-1380@kylheku.com> writes:

    The problem with --ignore-fail-on-non-empty that it's five words
    long.

    Snipped the rest of the post where you didn't even try to prove that 5
    words is a problem. As it is, the rarely used option explains itself.

    It doesn't explain itself.

    If I encountered it in a script I'd know exactly what it does.

    I had to look it up and experiment with it, and also rely on other documentation (POSIX). My first blind guess was: does it actually delete
    the nonempty directory, like rm -r? But no, that couldn't be it;
    that's significantly more than what "ignore" means.

    Okay maybe not a 100% explanation but it sure tells you a whole lot more
    than a 1 letter option or -ign-rmdir-fail.

    And you still haven't identified a problem with a long -- option.

    --
    Dan Espen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Dan Espen on Tue Jun 14 21:30:46 2022
    On 2022-06-14, Dan Espen <dan1espen@gmail.com> wrote:
    Kaz Kylheku <480-992-1380@kylheku.com> writes:

    On 2022-06-14, Dan Espen <dan1espen@gmail.com> wrote:
    Kaz Kylheku <480-992-1380@kylheku.com> writes:

    The problem with --ignore-fail-on-non-empty that it's five words
    long.

    Snipped the rest of the post where you didn't even try to prove that 5
    words is a problem. As it is, the rarely used option explains itself.

    It doesn't explain itself.

    If I encountered it in a script I'd know exactly what it does.

    I had to look it up and experiment with it, and also rely on other
    documentation (POSIX). My first blind guess was: does it actually delete
    the nonempty directory, like rm -r? But no, that couldn't be it;
    that's significantly more than what "ignore" means.

    Okay maybe not a 100% explanation but it sure tells you a whole lot more
    than a 1 letter option or -ign-rmdir-fail.

    Well, ign-rmdir-fails lies, because not not every kind of failure from
    rmdir is ignored.

    I would not have expended more effort to find out what it does
    if the GNU option had been called --fzi, but at least less eye effort to
    read it, and finger effort to type it.

    How about:

    --sne "Skip not empty"

    Effectively, skip directories which are not empty.
    Deletion is still tried for all directory arguments;
    but failure to delete a directory due to it being
    nonempty is not reflected in the termination status.

    The command itself has a short name: "remove directory" is condensed
    to "rmdir".

    If "stream editor" can become "sed", why can't "skip not empty"
    become "sne"?

    The nice thing about --sne is that when you don't know what that
    means, you *know* that you don't know; you look it up. But it's
    not just a random clump of letters like --fzi; it has mnemonic value.
    It's unlikely you will ever have to look it up more than twice.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helmut Waitzmann@21:1/5 to All on Wed Jun 15 00:50:17 2022
    Chris Elvidge <chris@mshome.net>:

    -v always equals --verbose would be a good idea. -V always being
    --version would perhaps also be a good idea?

    It's too late for that.  Look for example at the POSIX specification
    for "grep" (<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html#top>).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)