Bug 1473642 - /usr/sbin/clamav-notify-servers: line 72: warning: command substitution: ignored null byte in input [NEEDINFO]
/usr/sbin/clamav-notify-servers: line 72: warning: command substitution: igno...
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: clamav (Show other bugs)
26
x86_64 Unspecified
unspecified Severity low
: ---
: ---
Assigned To: Sergio Monteiro Basto
Fedora Extras Quality Assurance
:
: 1473867 1485461 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-21 07:18 EDT by Juan Orti
Modified: 2017-10-01 22:49 EDT (History)
22 users (show)

See Also:
Fixed In Version: clamav-0.99.2-12.fc27 clamav-0.99.2-12.fc26
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-09-30 02:36:22 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
sergio: needinfo? (tommy)


Attachments (Terms of Use)

  None (edit)
Description Juan Orti 2017-07-21 07:18:43 EDT
Description of problem:
I'm getting these when updating clamav:

/usr/sbin/clamav-notify-servers: línea 72: aviso: command substitution: ignored null byte in input

line 72 is:

resp=`printf 'zRELOAD\0' | timeout ${K_OPT:+-k $TIMEOUT_KILL} $TIMEOUT_TERM "${CMD[@]}"`

Version-Release number of selected component (if applicable):
clamav-server-0.99.2-1.fc25.x86_64
clamav-0.99.2-1.fc25.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Activate clamav updates in /etc/sysconfig/freshclam, /etc/freshclam.conf and /etc/cron.d/clamav-update

2. Configure server notification in /etc/freshclam.conf
NotifyClamd /etc/clamd.d/amavisd.conf

Actual results:
I receive the warning by email
Comment 1 Sergio Monteiro Basto 2017-07-21 07:53:00 EDT
Could you test clamav-0.99.2-9.fc25 ?

https://bodhi.fedoraproject.org/updates/?packages=clamav
Comment 2 Juan Orti 2017-07-21 10:31:07 EDT
The same error with clamav-0.99.2-9.fc25
Comment 3 Juan Orti 2017-07-21 10:35:32 EDT
Looks like it's a new feature of bash-4.4:

https://lists.gnu.org/archive/html/bug-bash/2016-09/msg00015.html
Comment 4 Jason Tibbitts 2017-07-21 17:42:27 EDT
This is kind of weird.  I don't think bash is complaining about the explicit NUL in the printf argument; it's complaining the that output of the timeout command contains a NUL which is thrown away.  I wonder what that output is and whether the NUL values in it are supposed to be somehow significant.

Since bash has always thrown away NUL bytes in this manner and is only just now warning about it, I guess it should be safe to add a "| tr -d \\0" on the end there.  That would be better than redirecting stdout to /dev/null, certainly.  But there's probably still a better way.
Comment 5 Sergio Monteiro Basto 2017-07-21 19:28:59 EDT
*** Bug 1473867 has been marked as a duplicate of this bug. ***
Comment 6 Tommy Hurtig 2017-07-22 11:26:40 EDT
It seems to me like changing the script to this fix the problem:

    printf 'zRELOAD\0' |  timeout ${K_OPT:+-k $TIMEOUT_KILL} $TIMEOUT_TERM "${CMD[@]}" | { read resp
      case $resp in
        (RELOADING)
          ;;
        (*)
          echo "clamd server '$i' gave '$resp' response" >&2
          let ++fail
          ;;
      esac
    }

Then using this, command substitution won't be used, and the new behaviour in bash 4.4 won't be triggered. I'n uncertain if there are any drawbacks?

There is some discussion about this behaviour in https://lists.gnu.org/archive/html/bug-bash/2016-09/msg00015.html
Comment 7 Sergio Monteiro Basto 2017-08-01 06:44:24 EDT
Hi, 

(In reply to Juan Orti from comment #0)

> Actual results:
> I receive the warning by email

This not affect the functionally of it , isn't it ? 

Thanks
Comment 8 dan 2017-08-01 09:43:58 EDT
Aside from flooding the forwarded root mbox with warning messages!
Comment 9 Juan Orti 2017-08-07 06:30:36 EDT
(In reply to Sergio Monteiro Basto from comment #7)
> This not affect the functionally of it , isn't it ? 

clamd reloads the database fine, the only inconvenience is the warning messages.
Comment 10 John Griffiths 2017-08-12 10:07:34 EDT
The bug thread in  https://lists.gnu.org/archive/html/bug-bash/2016-09/msg00015.html started 15 Sep 2016 and ended 20 Sep 2016.

Based on that, I don't think the behavior of bash is going to change, so the script is going to have to change to account for the bash 4.4 behavior. I personally think the bash 4.4 behavior is against the UNIX "Silence is golden" policy, but my opinion counts for nothing.

This should probably go upstream since it may effect any distro the is using bash 4.4.
Comment 11 Berrehouc Nicolas 2017-08-15 10:21:10 EDT
Same error after upgrading from F25 to F26 this morning.
clamav-0.99.2-9.fc26.x86_64 and bash-4.4.12-7.fc26.x86_64
Comment 12 John Griffiths 2017-08-18 09:27:37 EDT
(In reply to Tommy Hurtig from comment #6)
> It seems to me like changing the script to this fix the problem:
> 
>     printf 'zRELOAD\0' |  timeout ${K_OPT:+-k $TIMEOUT_KILL} $TIMEOUT_TERM
> "${CMD[@]}" | { read resp
>       case $resp in
>         (RELOADING)
>           ;;
>         (*)
>           echo "clamd server '$i' gave '$resp' response" >&2
>           let ++fail
>           ;;
>       esac
>     }
> 
> Then using this, command substitution won't be used, and the new behaviour
> in bash 4.4 won't be triggered. I'n uncertain if there are any drawbacks?
> 
> There is some discussion about this behaviour in
> https://lists.gnu.org/archive/html/bug-bash/2016-09/msg00015.html

Made this edit to the script and no longer get warning.
Comment 13 Sergio Monteiro Basto 2017-08-25 15:54:33 EDT
*** Bug 1485461 has been marked as a duplicate of this bug. ***
Comment 14 Sergio Monteiro Basto 2017-09-15 13:30:11 EDT
(In reply to Tommy Hurtig from comment #6)
> It seems to me like changing the script to this fix the problem:
> 
>     printf 'zRELOAD\0' |  timeout ${K_OPT:+-k $TIMEOUT_KILL} $TIMEOUT_TERM
> "${CMD[@]}" | { read resp
>       case $resp in
>         (RELOADING)
>           ;;
>         (*)
>           echo "clamd server '$i' gave '$resp' response" >&2
>           let ++fail
>           ;;
>       esac
>     }
> 
> Then using this, command substitution won't be used, and the new behaviour
> in bash 4.4 won't be triggered. I'n uncertain if there are any drawbacks?
> 
> There is some discussion about this behaviour in
> https://lists.gnu.org/archive/html/bug-bash/2016-09/msg00015.html

can you provide code in a patch ? please ,
Comment 15 Sergio Monteiro Basto 2017-09-15 14:41:07 EDT
ah clamav-notify-servers  is not from clamav source code , so only Fedora have this problem . Patch applied [1] , please test and verify , thanks 

[1] 
https://src.fedoraproject.org/cgit/rpms/clamav.git/commit/?id=f5e72a7773d6be5e9c99ae2edcb2754d503e9f87

https://src.fedoraproject.org/rpms/clamav/c/f5e72a7773d6be5e9c99ae2edcb2754d503e9f87?branch=master
Comment 16 Fedora Update System 2017-09-15 15:27:01 EDT
clamav-0.99.2-12.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-558529554f
Comment 17 Fedora Update System 2017-09-15 15:28:06 EDT
clamav-0.99.2-12.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-365b0241af
Comment 18 Fedora Update System 2017-09-16 14:22:21 EDT
clamav-0.99.2-12.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-558529554f
Comment 19 Fedora Update System 2017-09-17 06:50:39 EDT
clamav-0.99.2-12.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-365b0241af
Comment 20 Fedora Update System 2017-09-30 02:36:22 EDT
clamav-0.99.2-12.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.
Comment 21 John Griffiths 2017-09-30 04:53:31 EDT
Is this going to be pushed to FC26?
Comment 22 Sergio Monteiro Basto 2017-09-30 09:44:09 EDT
(In reply to John Griffiths from comment #21)
> Is this going to be pushed to FC26?

yes, but you may give positive karma and it will be automatic pushed , (I prefer this because ensures that we got tested ) 
Anyway I'm pushing it now .
Comment 23 Fedora Update System 2017-10-01 22:49:38 EDT
clamav-0.99.2-12.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.