• Another shellcheck rant...

    From Kenny McCormack@21:1/5 to All on Wed Mar 5 14:51:17 2025
    I have a loop like:

    exec 3< somefile
    while read -ru3 fn; do
    ffmpeg -i "$fn" ... "OutDir/$fn"
    done

    Shellcheck flags both the "read" and the "ffmpeg", with messages to the
    effect that ffmpeg might swallow up stdin - not realizing that the -u3
    means the "read" is not reading from stdin.

    It recommends using the -nostdin option on ffmpeg, which is weird. It is
    weird that it doesn't understand what -u3 means (which, I get, is bash-specific, but shellcheck is supposed to know about bash-specific
    things), yet it *does* know about an obscure option of an obscure program called "ffmpeg".

    Odd...

    Anyway and FWIW, I ended up adding -nostdin, which seems reasonable based
    on my reading of the "ffmpeg" man page, and does shut up both shellcheck messages.

    --
    b w r w g y b r y b

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Kenny McCormack on Wed Mar 5 18:50:30 2025
    On 2025-03-05, Kenny McCormack <gazelle@shell.xmission.com> wrote:
    I have a loop like:

    exec 3< somefile
    while read -ru3 fn; do
    ffmpeg -i "$fn" ... "OutDir/$fn"
    done

    Shellcheck flags both the "read" and the "ffmpeg", with messages to the effect that ffmpeg might swallow up stdin - not realizing that the -u3
    means the "read" is not reading from stdin.

    Maybe the shellcheck code does know about -u, but simply doesn't
    recognize it when it is clumped like that, together with another
    option and its own argument.


    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Kaz Kylheku on Wed Mar 5 19:55:10 2025
    On 05.03.2025 19:50, Kaz Kylheku wrote:
    On 2025-03-05, Kenny McCormack <gazelle@shell.xmission.com> wrote:
    I have a loop like:

    exec 3< somefile
    while read -ru3 fn; do
    ffmpeg -i "$fn" ... "OutDir/$fn"
    done

    Shellcheck flags both the "read" and the "ffmpeg", with messages to the
    effect that ffmpeg might swallow up stdin - not realizing that the -u3
    means the "read" is not reading from stdin.

    Maybe the shellcheck code does know about -u, but simply doesn't
    recognize it when it is clumped like that, together with another
    option and its own argument.

    This is actually what I had just tried out of curiosity (with that
    tool that I never used); the result is the same for 'read -r -u3'.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to 643-408-1753@kylheku.com on Wed Mar 5 22:32:25 2025
    In article <20250305104105.793@kylheku.com>,
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2025-03-05, Kenny McCormack <gazelle@shell.xmission.com> wrote:
    I have a loop like:

    exec 3< somefile
    while read -ru3 fn; do
    ffmpeg -i "$fn" ... "OutDir/$fn"
    done

    Shellcheck flags both the "read" and the "ffmpeg", with messages to the
    effect that ffmpeg might swallow up stdin - not realizing that the -u3
    means the "read" is not reading from stdin.

    Maybe the shellcheck code does know about -u, but simply doesn't
    recognize it when it is clumped like that, together with another
    option and its own argument.

    No, it's the same with just -u3. In fact, the original code (that I ran through shellcheck) had just -u3. I added the 'r' later on.

    I suppose I could try: -u 3
    but that's not really the point.
    --
    The scent of awk programmers is a lot more attractive to women than
    the scent of perl programmers.

    (Mike Brennan, quoted in the "GAWK" manual)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to 643-408-1753@kylheku.com on Wed Mar 5 22:44:56 2025
    In article <20250305104105.793@kylheku.com>,
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2025-03-05, Kenny McCormack <gazelle@shell.xmission.com> wrote:
    I have a loop like:

    exec 3< somefile
    while read -ru3 fn; do
    ffmpeg -i "$fn" ... "OutDir/$fn"
    done

    Shellcheck flags both the "read" and the "ffmpeg", with messages to the
    effect that ffmpeg might swallow up stdin - not realizing that the -u3
    means the "read" is not reading from stdin.

    Maybe the shellcheck code does know about -u, but simply doesn't
    recognize it when it is clumped like that, together with another
    option and its own argument.

    No, it's the same with just -u3. In fact, the original code (that I ran through shellcheck) had just -u3. I added the 'r' later on.

    I suppose I could try: -u 3
    but that's not really the point.

    --
    The randomly chosen signature file that would have appeared here is more than 4 lines long. As such, it violates one or more Usenet RFCs. In order to remain in compliance with said RFCs, the actual sig can be found at the following URL:
    http://user.xmission.com/~gazelle/Sigs/CLCtopics

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