The awk command that strips the --exclude and --include parameters from DUPL_PARAMS fails to remove a one byte parameter value.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The awk command that strips the --exclude and --include parameters from DUPL_PARAMS fails to remove a one byte parameter value.

duplicity-talk mailing list
original:

function duplicity_params_conf {
  # reuse cmd var from main loop
  ## in/exclude parameters are currently not supported on restores
  if [ "$cmd" = "fetch" ] || [ "$cmd" = "restore" ] || [ "$cmd" = "status" ]; then
    # filter exclude params from fetch/restore
                                                                               vvv
    echo "$DUPL_PARAMS" | awk '{gsub(/--(ex|in)clude[a-z-]*(([ \t]+|=)[^-][^ \t]+)?/,"");print}'
    return
  fi
  
  echo "$DUPL_PARAMS"
}


function duplicity_params_conf {
  # reuse cmd var from main loop
  ## in/exclude parameters are currently not supported on restores
  if [ "$cmd" = "fetch" ] || [ "$cmd" = "restore" ] || [ "$cmd" = "status" ]; then
    # filter exclude params from fetch/restore
                                                                               vvv
    echo "$DUPL_PARAMS" | awk '{gsub(/--(ex|in)clude[a-z-]*(([ \t]+|=)[^-][^ \t]*)?/,"");print}'
    return
  fi
  
  echo "$DUPL_PARAMS"
}


DUPL_PARAMS="$DUPL_PARAMS --include /etc --include /home --include /opt/zimbra/backup --exclude /"

duply failed to remove the / after --exclude.




_______________________________________________
Duplicity-talk mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/duplicity-talk
Reply | Threaded
Open this post in threaded view
|

Re: The awk command that strips the --exclude and --include parameters from DUPL_PARAMS fails to remove a one byte parameter value.

duplicity-talk mailing list
hey Rob,

i could reproduce the issue. as in/excludes might as well have spaces or might be be wrapped in apostrophes i will probably drop awk for this and writw a more elaborate function to do the stripping.

good catch! ..ede/duply.net

On 4/19/2018 21:39, Rob Adair 'Profitable Business Systems' via Duplicity-talk wrote:

> original:
>
> function duplicity_params_conf {
>   # reuse cmd var from main loop
>   ## in/exclude parameters are currently not supported on restores
>   if [ "$cmd" = "fetch" ] || [ "$cmd" = "restore" ] || [ "$cmd" = "status" ]; then
>     # filter exclude params from fetch/restore
>                                                                                vvv
>     echo "$DUPL_PARAMS" | awk '{gsub(/--(ex|in)clude[a-z-]*(([ \t]+|=)[^-][^ \t]+)?/,"");print}'
>     return
>   fi
>   
>   echo "$DUPL_PARAMS"
> }
>
>
> function duplicity_params_conf {
>   # reuse cmd var from main loop
>   ## in/exclude parameters are currently not supported on restores
>   if [ "$cmd" = "fetch" ] || [ "$cmd" = "restore" ] || [ "$cmd" = "status" ]; then
>     # filter exclude params from fetch/restore
>                                                                                vvv
>     echo "$DUPL_PARAMS" | awk '{gsub(/--(ex|in)clude[a-z-]*(([ \t]+|=)[^-][^ \t]*)?/,"");print}'
>     return
>   fi
>   
>   echo "$DUPL_PARAMS"
> }
>
>
> DUPL_PARAMS="$DUPL_PARAMS --include /etc --include /home --include /opt/zimbra/backup --exclude /"
>
> duply failed to remove the / after --exclude.
>
>
>
>
>
> _______________________________________________
> Duplicity-talk mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/duplicity-talk
>


_______________________________________________
Duplicity-talk mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/duplicity-talk
Reply | Threaded
Open this post in threaded view
|

Re: The awk command that strips the --exclude and --include parameters from DUPL_PARAMS fails to remove a one byte parameter value.

duplicity-talk mailing list
In reply to this post by duplicity-talk mailing list
hey Rob,

would you mind testing
  http://duply.net/wiki/index.php/Duply-code#Latest_Development_Snapshot
with an improved xclude stripping routine?

thanks ..ede/duply.net

On 4/19/2018 21:39, Rob Adair 'Profitable Business Systems' via Duplicity-talk wrote:

> original:
>
> function duplicity_params_conf {
>   # reuse cmd var from main loop
>   ## in/exclude parameters are currently not supported on restores
>   if [ "$cmd" = "fetch" ] || [ "$cmd" = "restore" ] || [ "$cmd" = "status" ]; then
>     # filter exclude params from fetch/restore
>                                                                                vvv
>     echo "$DUPL_PARAMS" | awk '{gsub(/--(ex|in)clude[a-z-]*(([ \t]+|=)[^-][^ \t]+)?/,"");print}'
>     return
>   fi
>   
>   echo "$DUPL_PARAMS"
> }
>
>
> function duplicity_params_conf {
>   # reuse cmd var from main loop
>   ## in/exclude parameters are currently not supported on restores
>   if [ "$cmd" = "fetch" ] || [ "$cmd" = "restore" ] || [ "$cmd" = "status" ]; then
>     # filter exclude params from fetch/restore
>                                                                                vvv
>     echo "$DUPL_PARAMS" | awk '{gsub(/--(ex|in)clude[a-z-]*(([ \t]+|=)[^-][^ \t]*)?/,"");print}'
>     return
>   fi
>   
>   echo "$DUPL_PARAMS"
> }
>
>
> DUPL_PARAMS="$DUPL_PARAMS --include /etc --include /home --include /opt/zimbra/backup --exclude /"
>
> duply failed to remove the / after --exclude.
>
>
>
>
>
> _______________________________________________
> Duplicity-talk mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/duplicity-talk
>


_______________________________________________
Duplicity-talk mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/duplicity-talk