Bug#976865: Fwd: Bug#974900: dash removes trailing slash from script arguments

2020-12-10 Thread Jeff King
On Fri, Dec 11, 2020 at 01:03:11PM +1100, Herbert Xu wrote:

> On Thu, Dec 10, 2020 at 10:20:29AM -0500, Jeff King wrote:
> >
> > It seems like it happens for "foo/", too. If I compile:
> 
> I think the key is that dash uses GLOB_NOMAGIC.

I wondered that, too, but adding GLOB_NOMAGIC to the call doesn't seem
to change the results. This is all with libc6 2.31-5, by the way.

-Peff



Bug#976865: Fwd: Bug#974900: dash removes trailing slash from script arguments

2020-12-10 Thread Herbert Xu
On Thu, Dec 10, 2020 at 10:20:29AM -0500, Jeff King wrote:
>
> It seems like it happens for "foo/", too. If I compile:

I think the key is that dash uses GLOB_NOMAGIC.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[bts-link] source package src:glibc

2020-12-10 Thread debian-bts-link
#
# bts-link upstream status pull for source package src:glibc
# see http://lists.debian.org/debian-devel-announce/2006/05/msg1.html
# https://bts-link-team.pages.debian.net/bts-link/
#

user debian-bts-l...@lists.debian.org

# remote status report for #976391 (http://bugs.debian.org/976391)
# Bug title: glibc: CVE-2020-29562
#  * http://sourceware.org/bugzilla/show_bug.cgi?id=26923
#  * remote status changed: (?) -> RESOLVED
#  * remote resolution changed: (?) -> FIXED
#  * closed upstream
tags 976391 + fixed-upstream
usertags 976391 + status-RESOLVED resolution-FIXED

thanks



[bts-link] source package glibc

2020-12-10 Thread debian-bts-link
#
# bts-link upstream status pull for source package glibc
# see http://lists.debian.org/debian-devel-announce/2006/05/msg1.html
# https://bts-link-team.pages.debian.net/bts-link/
#

user debian-bts-l...@lists.debian.org

# remote status report for #731082 (http://bugs.debian.org/731082)
# Bug title: ld.so.cache parsing code does not deal with mixed endianess 
multiarch, causing segfaults
#  * http://sourceware.org/bugzilla/show_bug.cgi?id=27008
#  * remote status changed: (?) -> RESOLVED
#  * remote resolution changed: (?) -> FIXED
usertags 731082 + status-RESOLVED resolution-FIXED

thanks



Processed: [bts-link] source package src:glibc

2020-12-10 Thread Debian Bug Tracking System
Processing commands for cont...@bugs.debian.org:

> #
> # bts-link upstream status pull for source package src:glibc
> # see http://lists.debian.org/debian-devel-announce/2006/05/msg1.html
> # https://bts-link-team.pages.debian.net/bts-link/
> #
> user debian-bts-l...@lists.debian.org
Setting user to debian-bts-l...@lists.debian.org (was 
debian-bts-l...@lists.debian.org).
> # remote status report for #976391 (http://bugs.debian.org/976391)
> # Bug title: glibc: CVE-2020-29562
> #  * http://sourceware.org/bugzilla/show_bug.cgi?id=26923
> #  * remote status changed: (?) -> RESOLVED
> #  * remote resolution changed: (?) -> FIXED
> #  * closed upstream
> tags 976391 + fixed-upstream
Bug #976391 [src:glibc] glibc: CVE-2020-29562
Added tag(s) fixed-upstream.
> usertags 976391 + status-RESOLVED resolution-FIXED
There were no usertags set.
Usertags are now: status-RESOLVED resolution-FIXED.
> thanks
Stopping processing here.

Please contact me if you need assistance.
-- 
976391: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=976391
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#976865: Fwd: Bug#974900: dash removes trailing slash from script arguments

2020-12-10 Thread Jeff King
On Thu, Dec 10, 2020 at 10:35:08PM +1100, Herbert Xu wrote:

> Yes but it's really a bug in glob(3).  It should really return
> a no-match for the case in question, rather than matching and then
> returning a filename without the slash.
> 
> IOW the pattern "foo\/" should not match a regular file foo.
> 
> Note that the problem doesn't occur for "foo/".

It seems like it happens for "foo/", too. If I compile:

-- >8 --
#include 
#include 

int main(int argc, const char **argv)
{
while (*++argv) {
glob_t r;
if (glob(*argv, 0, NULL, ))
perror(*argv);
else {
size_t i;
for (i = 0; i < r.gl_pathc; i++)
printf("%s -> %s\n", *argv, r.gl_pathv[i]);
globfree();
}
}
return 0;
}
-- >8 --

I get:

  $ rm -f foo bar
  $ touch foo
  $ ./a.out foo foo/ 'foo\/' bar bar/ 'bar\/'
  foo -> foo
  foo/ -> foo
  foo\/ -> foo
  bar: No such file or directory
  bar/: No such file or directory
  bar\/: No such file or directory

-Peff



Bug#976865: Fwd: Bug#974900: dash removes trailing slash from script arguments

2020-12-10 Thread Herbert Xu
On Wed, Dec 09, 2020 at 01:27:17PM +0100, Aurelien Jarno wrote:
>
> Can you please describe more precisely what is the problem with glob(3)?

Create a regular file called "foo", then call glob(3) with the
pattern "foo\/".  This returns a single match with the string
"foo".  This should return no match.

If you change the pattern to "foo/", then it also matches but
returns with the string "foo/" as expected.

The only flag we pass to glob(3) is GLOB_NOMAGIC.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#976865: Fwd: Bug#974900: dash removes trailing slash from script arguments

2020-12-10 Thread Herbert Xu
On Thu, Dec 10, 2020 at 08:58:37AM +0100, Aurelien Jarno wrote:
>
> That's the dash symptoms. glob(3) takes a pattern and just returns the
> paths matching the pattern, as they are named on the filesystem. That
> said, the option GLOB_MARK can return a trailing slash for all matched
> path that are a directory.

Yes but it's really a bug in glob(3).  It should really return
a no-match for the case in question, rather than matching and then
returning a filename without the slash.

IOW the pattern "foo\/" should not match a regular file foo.

Note that the problem doesn't occur for "foo/".

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#976865: Fwd: Bug#974900: dash removes trailing slash from script arguments

2020-12-10 Thread Aurelien Jarno
On 2020-12-10 13:56, Herbert Xu wrote:
> Aurelien Jarno  wrote:
> >
> > Can you please describe more precisely what is the problem with glob(3)?
> 
> It's stripping trailing slashes from the pattern, even when the
> name in question is a regular file.
> 
> https://patchwork.kernel.org/project/dash/patch/20201116025222.ga28...@gondor.apana.org.au/

That's the dash symptoms. glob(3) takes a pattern and just returns the
paths matching the pattern, as they are named on the filesystem. That
said, the option GLOB_MARK can return a trailing slash for all matched
path that are a directory.

-- 
Aurelien Jarno  GPG: 4096R/1DDD8C9B
aurel...@aurel32.net http://www.aurel32.net