Since rc-scripts use > to send text to a file instead of >|, if you run a rc-script from a bash prompt with noclobber option, it may not work properly: # /etc/init.d/iptables save * Saving iptables state... /sbin/runscript.sh: line 79: /var/lib/iptables/rules-save: cannot overwrite existing file [ !! ] Please use >| instead of > Examples: /etc/init.d/bootsplash - echo "silent" > /proc/splash + echo "silent" >| /proc/splash /etc/init.d/iptables init.d_fix/iptables - echo "1" > /proc/sys/net/ipv4/conf/all/forwarding + echo "1" >| /proc/sys/net/ipv4/conf/all/forwarding - echo "0" > /proc/sys/net/ipv4/conf/all/forwarding + echo "0" >| /proc/sys/net/ipv4/conf/all/forwarding - /sbin/iptables-save ${SAVE_RESTORE_OPTIONS} > ${IPTABLES_SAVE} + /sbin/iptables-save ${SAVE_RESTORE_OPTIONS} >| ${IPTABLES_SAVE} eend $? /etc/init.d/net.eth0 - echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter + echo -n 1 >| /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
perhaps the better fix is to disable noclobber in /sbin/runscript.sh
hrm, you never mentioned what baselayout you were using, and it seems to work fine for me: root@phear 0 ~ # set -o noclobber root@phear 0 ~ # echo > f root@phear 0 ~ # echo > f -bash: f: cannot overwrite existing file root@phear 0 ~ # /etc/init.d/iptables save * Saving iptables state ... [ ok ] root@phear 0 ~ # /etc/init.d/iptables pause * Saving iptables state ... [ ok ] * Stopping firewall ... [ ok ] root@phear 0 ~ # /etc/init.d/iptables start * Loading iptables state and starting firewall ... * Restoring iptables ruleset [ ok ]
> perhaps the better fix is to disable noclobber in /sbin/runscript.sh Yes, it looks a smarter sollution ;) At least /usr/sbin/etc-update also needs this fix > hrm, you never mentioned what baselayout you were using, and it seems to work fine for me The iptables POC I posted was reproduced with sys-apps/baselayout-1.9.4-r6 and net-firewall/iptables-1.2.11-r3
ok, well try again with 1.11.x (that's what i tested with) etc-update is a different issue, that has nothing to do with rc-scripts (it's part of portage)
Sorry, allexport must also be activated. With noclobber on and allexport on is when this error happens.
ok, that explains it a bit more ...
but unless someone can propose a clean solution to prevent the allexport option from screwing things up, we arent going to waste energy on this allexport can break via shell options or aliases or bash functions