[Pkg-samba-maint] Bug#776259: samba-common.postinst searches smb.conf for non-existent "[cdrom]" keyword

Nathan Stratton Treadway debbugs2015 at nathanst.com
Mon Jan 26 01:16:46 UTC 2015

Package: samba
Version: 2:4.1.6+dfsg-1

In the past when I upgraded my samba packages, the samba-common.postinst
script automatically copied my locally-defined shares from smb.conf onto
the end of the generated smb.conf.ucf-dist file... but recently I
noticed that's no longer happening.

Looking at the postinst script, I believe the problem is that the code
uses the "[cdrom]" keyword as a flag for finding the end of the
"as-distributed-by-the-package" section:

  cp /usr/share/samba/smb.conf "$NEWFILE"
  configure_smb_conf "$NEWFILE"

  if [ -e "$CONFIG" ]; then
          sed -e '1,/^[;#[:space:]]*\[cdrom\]/ { d }
                  1,/^[[:space:]]*\[/ { /^[^[]/d; /^$/d }
          ' "$CONFIG" >> "$NEWFILE"

... but (as of commit 16c3c21335025) that keyword no longer exists in
the /usr/share/samba/smb.conf template file -- and thus after switching
to an smb.conf file generated from that "new" template, on later package
upgrades the "sed" command doesn't find that keyword any more, and
thus no lines get appended at the end of $NEWFILE .

Perhaps it makes sense to introduce a custom, specific comment line for
this purpose? Something like


or whatever.  (In that case, the postinst script could just copy all
lines after that one from $CONFIG  to $NEWFILE.)


More information about the Pkg-samba-maint mailing list