<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>176548</bug_id>
          
          <creation_ts>2007-04-30 11:13 0000</creation_ts>
          <short_desc>net-proxy/dante-1.1.19: /etc/init.d/dante-sockd errors (maybe due to sys-apps/baselayout-2.0.0_alpha1)</short_desc>
          <delta_ts>2007-05-03 08:09:47 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>baselayout</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>alessandro.guido+bugzilla@gmail.com</reporter>
          <assigned_to>net-proxy@gentoo.org</assigned_to>
          <cc>uberlord@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>alessandro.guido+bugzilla@gmail.com</who>
            <bug_when>2007-04-30 11:13:04 0000</bug_when>
            <thetext>at boot, reboot or whenever I launch an init script, I get this error messages:

/etc/init.d/dante-sockd: line 7: [: : integer expression expected
/etc/init.d/dante-sockd: line 8: [: : integer expression expected
/etc/init.d/dante-sockd: line 9: [: : integer expression expected

(probably due to sys-apps/baselayout-2.0.0_alpha1)

Reproducible: Always




$ emerge --info
Portage 2.1.2.5 (default-linux/x86/2007.0/desktop, gcc-4.1.2, glibc-2.5-r1, 2.6.21-cfs-v7 i686)
=================================================================
System uname: 2.6.21-cfs-v7 i686 Intel(R) Pentium(R) M processor 1.86GHz
Gentoo Base System release 2.0.0_alpha1
Timestamp of tree: Mon, 30 Apr 2007 07:00:10 +0000
dev-java/java-config: 1.3.7, 2.0.31-r7
dev-lang/python:     2.5-r2
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17.50.0.14
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.20-r2
ACCEPT_KEYWORDS=&quot;x86 ~x86&quot;
AUTOCLEAN=&quot;yes&quot;
CBUILD=&quot;i686-pc-linux-gnu&quot;
CFLAGS=&quot;-pipe -O2 -march=pentium-m -fomit-frame-pointer&quot;
CHOST=&quot;i686-pc-linux-gnu&quot;
CONFIG_PROTECT=&quot;/etc /usr/share/X11/xkb&quot;
CONFIG_PROTECT_MASK=&quot;/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/php/apache1-php4/ext-active/ /etc/php/apache2-php4/ext-active/ /etc/php/cgi-php4/ext-active/ /etc/php/cli-php4/ext-active/ /etc/revdep-rebuild /etc/terminfo&quot;
CXXFLAGS=&quot;-pipe -O2 -march=pentium-m -fomit-frame-pointer -fvisibility-inlines-hidden -fvisibility=hidden&quot;
DISTDIR=&quot;/var/portage/distfiles&quot;
FEATURES=&quot;distlocks metadata-transfer nodoc noinfo parallel-fetch sandbox sfperms strict tmpfs&quot;
GENTOO_MIRRORS=&quot;ftp://pandemonium.tiscali.de/pub/gentoo/&quot;
LANG=&quot;it_IT.UTF-8&quot;
LDFLAGS=&quot;-Wl,--hash-style=gnu -Wl,--as-needed&quot;
LINGUAS=&quot;it&quot;
MAKEOPTS=&quot;--quiet&quot;
PKGDIR=&quot;/var/portage/packages&quot;
PORTAGE_RSYNC_OPTS=&quot;--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*&quot;
PORTAGE_TMPDIR=&quot;/var/tmp&quot;
PORTDIR=&quot;/var/portage&quot;
SYNC=&quot;rsync://rsync.gentoo.org/gentoo-portage&quot;
USE=&quot;acpi apache2 bitmap-fonts cairo cdr cli dbus dvd dvdr dvdread emboss evo firefox gif gnome gstreamer hal isdnlog jpeg libg++ libnotify mad midi mikmod mmx mp3 nls nptl nptlonly ogg opengl pdf png pppd qt3support quicktime reflection session spl sse sse2 startup-notification svg threads truetype-fonts type1-fonts udev unicode vorbis win32codecs x86 xinerama xml xorg xv zlib&quot; ALSA_CARDS=&quot;ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci&quot; ALSA_PCM_PLUGINS=&quot;adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol&quot; CAMERAS=&quot;ptp2&quot; ELIBC=&quot;glibc&quot; INPUT_DEVICES=&quot;keyboard mouse synaptics&quot; KERNEL=&quot;linux&quot; LCD_DEVICES=&quot;bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text&quot; LINGUAS=&quot;it&quot; USERLAND=&quot;GNU&quot; VIDEO_CARDS=&quot;none nvidia&quot;
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>uberlord@gentoo.org</who>
            <bug_when>2007-05-02 12:54:33 0000</bug_when>
            <thetext>Yeah, those are invalid tests.
You should either test to see if there&apos;s a value there
[ -n &quot;${foo}&quot; ]

or give it a default if it&apos;s not
[ &quot;${foo:-0}&quot; -gt 1 ]</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-05-02 19:30:01 0000</bug_when>
            <thetext>I don&apos;t understand why is this net-proxy&apos;s bug. dante installs a /etc/conf.d/dante-sockd file in which all these parameters are set.

But have it your way. Fixed by imposing a default value to all those parameters.
Revision has been bumped with the same keywords as 1.1.19.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>uberlord@gentoo.org</who>
            <bug_when>2007-05-02 19:45:02 0000</bug_when>
            <thetext>(In reply to comment #2)
&gt; I don&apos;t understand why is this net-proxy&apos;s bug. dante installs a
&gt; /etc/conf.d/dante-sockd file in which all these parameters are set.

Well it&apos;s hardly base-systems bug when we don&apos;t care about the config nor the init script.

baselayout-2 calls bash via /bin/sh which imposes a few more POSIX restrictions on how you write shell scripts. Basically it&apos;s not as forgiving to any errors.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-05-02 19:54:19 0000</bug_when>
            <thetext>Still, those parameters should have values at that point. Regardless of the shell that executes them, writing:
  conf.d script: foo=1
  init.d script: [ $foo -eq 1 ]
or
  conf.d script: foo=0
  init.d script: [ ${foo:-0} -eq 1 ]
should have the exact same result.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-05-02 19:56:10 0000</bug_when>
            <thetext>s/foo=0/foo=1/</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>uberlord@gentoo.org</who>
            <bug_when>2007-05-02 20:09:03 0000</bug_when>
            <thetext>Say that the config file doesn&apos;t exist or user has commented value out? Should base-system still be to blame? Or maybe then you would pick on the user?

roy@uberlaptop ~ $ [ &quot;${nodefined}&quot; -eq 1 ]
-bash: [: : integer expression expected
roy@uberlaptop ~ $ [ &quot;${nodefined:-0}&quot; -eq 1 ]
roy@uberlaptop ~ $ 

Or maybe you could do this
[ &quot;${nodefined}&quot; = 1 ]

That only works for a string comparison, obviously not for integer comparisons.

Or maybe a value is required, at which point you should exit gracefully with a descriptive error.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-05-02 21:35:59 0000</bug_when>
            <thetext>@reporter: Do you have the /etc/conf.d/dante-sockd file? What non-comment lines do you have in it?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>alessandro.guido+bugzilla@gmail.com</who>
            <bug_when>2007-05-03 07:14:08 0000</bug_when>
            <thetext>iro@odino ~ $ cat /etc/conf.d/dante-sockd | grep -v &apos;^#&apos;

SOCKD_FORKDEPTH=1

SOCKD_DEBUG=0

SOCKD_DISABLE_KEEPALIVE=1



</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-05-03 07:25:20 0000</bug_when>
            <thetext>Q.E.D.

This shows that conf.d file hasn&apos;t been executed before init.d file.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>uberlord@gentoo.org</who>
            <bug_when>2007-05-03 08:09:47 0000</bug_when>
            <thetext>You&apos;re right, when we generate our dependency tree we do load the init script before the config but when we execute a script we do it the other way around. This has been corrected and will appear in alpha2.

However, my argument about checking variables before doing integer evaluation still stands :)</thetext>
          </long_desc>
      
    </bug>

</bugzilla>