Re: [Bug-tar] tar -T improperly handle escaped characters

2013-11-02 Thread Sergey Poznyakoff
Hi Nicolas,

> What should I report to the Docker developper regarding a fix. Should
> distributions patch tar or will there be a minor release?

I think I'd better make a minor release, let's say in a week.

Regards,
Sergey



Re: [Bug-tar] tar -T improperly handle escaped characters

2013-11-02 Thread Nicolas Dudebout
Sergey,

What should I report to the Docker developper regarding a fix. Should
distributions patch tar or will there be a minor release?

Thanks in advance


On Sat, Nov 2, 2013 at 1:11 PM, Nicolas Dudebout  wrote:

> Sergey,
>
> Thank you very much for the prompt fix. It does indeed work.
>
> I was about to try and write the regression test for it but I do not
> really understand the `.at` format.
>
> Nicolas
>
>
> On Sat, Nov 2, 2013 at 5:30 AM, Sergey Poznyakoff  wrote:
>
>> Hi Nicolas,
>>
>> Please try the attached patch.
>>
>> Regards,
>> Sergey
>>
>>
>


Re: [Bug-tar] tar -T improperly handle escaped characters

2013-11-02 Thread Nicolas Dudebout
Sergey,

Thank you very much for the prompt fix. It does indeed work.

I was about to try and write the regression test for it but I do not really
understand the `.at` format.

Nicolas


On Sat, Nov 2, 2013 at 5:30 AM, Sergey Poznyakoff  wrote:

> Hi Nicolas,
>
> Please try the attached patch.
>
> Regards,
> Sergey
>
>


Re: [Bug-tar] tar -T improperly handle escaped characters

2013-11-02 Thread Sergey Poznyakoff
Hi Nicolas,

Please try the attached patch.

Regards,
Sergey

diff --git a/src/names.c b/src/names.c
index eecb9b0..fc9841e 100644
--- a/src/names.c
+++ b/src/names.c
@@ -492,6 +492,8 @@ read_next_name (struct name_elt *ent, struct name_elt *ret)
 	  ent->v.file.term = 0;
 	  /* fall through */
 	case file_list_success:
+	  if (unquote_option)
+	unquote_string (name_buffer);
 	  if (handle_option (name_buffer) == 0)
 	{
 	  name_list_adjust ();


Re: [Bug-tar] tar -T improperly handle escaped characters

2013-10-30 Thread Nicolas Dudebout
Sergey,

You ran into the problem mentionned by Erik.
Make sure the content of the file baz is:

```
foo\055bar
```

Running the commands like a script like you did puts two backslashes.

Nicolas


On Wed, Oct 30, 2013 at 5:10 PM, Sergey Poznyakoff  wrote:

> Hi Nicolas,
>
> > The `--files-from` (`-T`) option does not properly work in 1.27 but was
> > properly working in 1.26. It fails in the presence of escaped characters
> as
> > described in the following code snippet:
> >
> > ```
> > mkdir test
> > cd test
> > echo something > foo-bar
> > echo 'foo\\055bar' > baz
> > tar -cf qux.tar -T baz
> > ```
>
> I get the same behavior with both 1.26 and 1.27:
>
> gray@ulysses:~/tmp$ tar --version
> tar (GNU tar) 1.26
> Copyright (C) 2011 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> .
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
>
> Written by John Gilmore and Jay Fenlason.
> gray@ulysses:~/tmp$ sh f.sh
> tar: foo\\055bar: Cannot stat: No such file or directory
> tar: Exiting with failure status due to previous errors
>
> Regards,
> Sergey
>


Re: [Bug-tar] tar -T improperly handle escaped characters

2013-10-30 Thread Sergey Poznyakoff
Hi Nicolas,

> The `--files-from` (`-T`) option does not properly work in 1.27 but was
> properly working in 1.26. It fails in the presence of escaped characters as
> described in the following code snippet:
> 
> ```
> mkdir test
> cd test
> echo something > foo-bar
> echo 'foo\\055bar' > baz
> tar -cf qux.tar -T baz
> ```

I get the same behavior with both 1.26 and 1.27:

gray@ulysses:~/tmp$ tar --version
tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
gray@ulysses:~/tmp$ sh f.sh
tar: foo\\055bar: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors

Regards,
Sergey



Re: [Bug-tar] tar -T improperly handle escaped characters

2013-10-30 Thread Eric Blake
On 10/29/2013 02:41 PM, Nicolas Dudebout wrote:
> The `--files-from` (`-T`) option does not properly work in 1.27 but was
> properly working in 1.26. It fails in the presence of escaped characters as
> described in the following code snippet:
> 
> ```
> mkdir test
> cd test
> echo something > foo-bar
> echo 'foo\\055bar' > baz

echo'ing a backslash is non-portable.  Are you sure that you are getting
the contents you intended?  To be portable, use printf(1) instead of
echo(1) whenever \ is involved.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [Bug-tar] tar -T improperly handle escaped characters

2013-10-30 Thread Nicolas Dudebout
echoing was only done in this bug report to give the use case. I actually
wrote the file manually and had the same problem.

This problem came up in docker as reported in this issue:
https://github.com/dotcloud/docker/issues/2403


On Wed, Oct 30, 2013 at 2:29 PM, Eric Blake  wrote:

> On 10/29/2013 02:41 PM, Nicolas Dudebout wrote:
> > The `--files-from` (`-T`) option does not properly work in 1.27 but was
> > properly working in 1.26. It fails in the presence of escaped characters
> as
> > described in the following code snippet:
> >
> > ```
> > mkdir test
> > cd test
> > echo something > foo-bar
> > echo 'foo\\055bar' > baz
>
> echo'ing a backslash is non-portable.  Are you sure that you are getting
> the contents you intended?  To be portable, use printf(1) instead of
> echo(1) whenever \ is involved.
>
> --
> Eric Blake   eblake redhat com+1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>