bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] [PATCH 0/1] Notes for wordsplit (was: Allow tar to usecommand


From: Pavel Raiskup
Subject: [Bug-tar] [PATCH 0/1] Notes for wordsplit (was: Allow tar to usecommand for compressing consisiting of multiple words.)
Date: Wed, 20 Feb 2013 10:15:26 +0100

>>    In short, there would be nice to allow maintainers to specify something
>>    like this:
>>
>>      ./configure --with-lzma="xz --format=lzma"
>
> I have pushed the necessary fixes (commit 7b5e8039).  Any option taking
> a command name as its argument now accepts a full command line as well.
> These options are:
>
>   --checkpoint-action=exec
>   -I, --use-compress-program
>   -F, --info-script
>   --to-command
>
> Thus, one can do "tar -c -I 'gzip -9' .", for example.
>
> The argument is split using almost the same rules as used by the shell
> (excepting command substitution and arithmetic expansion).  For the
> commands that take additional information from environment variables
> created by tar it is now possible to pass these in the command line
> as well (escaping them from being expanded prematurely), e.g.:
>
>   tar -x -f a.tar --info-script='changevol $TAR_ARCHIVE $TAR_VOLUME'

Hi Sergey, thanks for pushing this!

I really like this new code!  Even when it is quite big amount of new code.
It seems that it comes from mailutils (but not mentioned in your patch - not in
mailutils) - probably some central place for the wordsplit.[ch] code should be
found in future to avoid something like this?

    http://lists.gnu.org/archive/html/bug-cpio/2012-10/msg00000.html

I have ran Coverity to scan for the new defects and it seems that there are
three very small defects worth to fix:

| diff --git a/lib/wordsplit.c b/lib/wordsplit.c
| index bd5d59d..bc9e593 100644
| --- a/lib/wordsplit.c
| +++ b/lib/wordsplit.c
| @@ -437,10 +437,12 @@ coalesce_segment (struct wordsplit *wsp, struct 
wordsplit_node *node)
|    int stop;
| 
|    for (p = node; p && (p->flags & _WSNF_JOIN); p = p->next)
| +  /*   ----------^ (this is not necessary) */
|      {
|        len += wsnode_len (p);
|      }
|    len += wsnode_len (p);
| +  /* it if was ->    ^-- here is segfault */
|    end = p;
| 
|    buf = malloc (len + 1);
| @@ -705,7 +707,7 @@ expvar (struct wordsplit *wsp, const char *str, size_t 
len,
| struct wordsplit_node **ptail, const char **pend, int flg)
|  {
|    size_t i = 0;
| -  const char *defstr = NULL;
| +  const char *defstr;
| +  /* there ------------^^^^ was a redundant assignment */
|    const char *value;
|    const char *vptr;
|    struct wordsplit_node *newnode;
| @@ -1581,6 +1583,7 @@ wordsplit_perror (struct wordsplit *wsp)
| 
|      case WRDSE_NOSUPP:
|        wsp->ws_error (_("command substitution is not yet supported"));
| +      break;
| +      /* ^^^^^^ (missing break) */
| 
|      case WRDSE_USAGE:
|        wsp->ws_error (_("invalid wordsplit usage"));

Another problem is that I'm unable to compile the new code with
  './configure && make';
I must run the
  './configure --disable-gcc-warnings && make'
to avoid build problems.

[PATCH] tar: simplify code in system.c

I'm sending also patch ^^^ for system.c which could be considered as useful,
thanks for looking at it and thanks for your work on this feature :) !

Pavel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]