[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt cron script changes



does this mean the patch wont get considered until i make it POSIX compliant?
im using things like '[[' for convinience, but things like '=~' to do some sanity checking.
is there a chance of changing the shebang to specificy /bin/bash and make it acceptable to the policy? and still use bashisms?


On Wed, Apr 19, 2006 at 07:19:56PM +0100, Adam D. Barratt wrote:
> On Wed, 2006-04-19 at 13:06 +0200, Hiren Patel wrote:
> > greetings.
> > 
> > i made what i think are improvements to the /etc/cron.daily/apt script.
> [...]
> 
> Just a very quick comment:
> 
> >  #!/bin/sh
> >  #
> 
> If the shebang line specifies /bin/sh then you're restricted by Policy
> to only using POSIX-compliant features. Which means you can't do the
> following:
>  
> [...]
> > +    if [[ "$#" -ne 2 ]]; then
> [...]
> > +    local file="$1"
> [...]
> > +	if [[ "$file_mod_time" =~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}$' ]]; then
> 
> since none of [[, local and =~ are part of POSIX / SUS.
> 
> [...]
> > +    if ! [[ "$MaxAge" -ge 0 && "$MinAge" -ge 0 && "$MaxSize" -ge 0 ]]; then
> 
> Likewise:
> 
>   if ! ( [ "$MaxAge" -ge 0 ] && [ "$MinAge" -ge 0 ] && [ "$MaxSize" - ge
> 0 ] ); then
> 
> (although I'd personally remove the negation and make it:
> 
>   if [ "$MaxAge" -lt 0 ] || [ "$MinAge" - lt 0 ] || [ "$MaxSize" -lt
> 0 ]; then
> 
> )
> 
> Regards,
> 
> Adam



Reply to: