public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* cygpath 1.7 wrong
@ 2008-06-03 20:15 Reini Urban
  2008-06-09 14:24 ` Corinna Vinschen
  0 siblings, 1 reply; 16+ messages in thread
From: Reini Urban @ 2008-06-03 20:15 UTC (permalink / raw)
  To: CygWin-Apps

conv_posix_to_win relative is wrong in the 1.7 series.
Not only cygpath, also the cygwin1.dll call
cygwin_conv_path(CCP_POSIX_TO_WIN_W | CCP_RELATIVE,..)

I don't want to upload a new perl for release-2 with this failure.

$ uname -a
CYGWIN_NT-5.1 cygwin17 1.7.0(0.185/5/2) 2008-05-25 20:10 i686 Cygwin

$ mkdir -p t/lib

$ cygpath -aw t/lib
C:\cygwin-1.7\usr\src\perl\perl-5.10.0\builddebug\t\lib

$ cygpath -w t/lib
\ib

$ mount -m
mount -f -b "C:/cygwin-1.7/bin" "/usr/bin"
mount -f -b "C:/cygwin-1.7/lib" "/usr/lib"
mount -f -b "C:/cygwin-1.7" "/"
mount -s -b --change-cygdrive-prefix "/cygdrive/"

$ tail /etc/fstab
C:/cygwin-1.7 / some_fs binary 0 0
C:/cygwin-1.7/bin /usr/bin some_fs binary 0 0
C:/cygwin-1.7/lib /usr/lib some_fs binary 0 0
# This is default anyway:
# none /cygdrive cygdrive binary,user 0 0

-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-03 20:15 cygpath 1.7 wrong Reini Urban
@ 2008-06-09 14:24 ` Corinna Vinschen
  2008-06-13  8:29   ` Corinna Vinschen
  0 siblings, 1 reply; 16+ messages in thread
From: Corinna Vinschen @ 2008-06-09 14:24 UTC (permalink / raw)
  To: cygwin-apps

On Jun  3 22:18, Reini Urban wrote:
> conv_posix_to_win relative is wrong in the 1.7 series.
> Not only cygpath, also the cygwin1.dll call
> cygwin_conv_path(CCP_POSIX_TO_WIN_W | CCP_RELATIVE,..)
>
> I don't want to upload a new perl for release-2 with this failure.
>
> $ uname -a
> CYGWIN_NT-5.1 cygwin17 1.7.0(0.185/5/2) 2008-05-25 20:10 i686 Cygwin
>
> $ mkdir -p t/lib
>
> $ cygpath -aw t/lib
> C:\cygwin-1.7\usr\src\perl\perl-5.10.0\builddebug\t\lib
>
> $ cygpath -w t/lib
> \ib

Ouch.  I'll look into it in the next couple of days.


Thanks for the report,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-09 14:24 ` Corinna Vinschen
@ 2008-06-13  8:29   ` Corinna Vinschen
  2008-06-13 13:04     ` Reini Urban
  0 siblings, 1 reply; 16+ messages in thread
From: Corinna Vinschen @ 2008-06-13  8:29 UTC (permalink / raw)
  To: cygwin-apps

On Jun  9 16:24, Corinna Vinschen wrote:
> On Jun  3 22:18, Reini Urban wrote:
> > $ mkdir -p t/lib
> >
> > $ cygpath -aw t/lib
> > C:\cygwin-1.7\usr\src\perl\perl-5.10.0\builddebug\t\lib
> >
> > $ cygpath -w t/lib
> > \ib
> 
> Ouch.  I'll look into it in the next couple of days.

I've uploaded 1.7.0-17 which contains a fix for that.  Please give it
a try.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13  8:29   ` Corinna Vinschen
@ 2008-06-13 13:04     ` Reini Urban
  2008-06-13 13:14       ` Eric Blake
  2008-06-13 14:31       ` Corinna Vinschen
  0 siblings, 2 replies; 16+ messages in thread
From: Reini Urban @ 2008-06-13 13:04 UTC (permalink / raw)
  To: cygwin-apps

Corinna Vinschen schrieb:
> On Jun  9 16:24, Corinna Vinschen wrote:
>> On Jun  3 22:18, Reini Urban wrote:
>>> $ mkdir -p t/lib
>>>
>>> $ cygpath -aw t/lib
>>> C:\cygwin-1.7\usr\src\perl\perl-5.10.0\builddebug\t\lib
>>>
>>> $ cygpath -w t/lib
>>> \ib
>> Ouch.  I'll look into it in the next couple of days.
> 
> I've uploaded 1.7.0-17 which contains a fix for that.  Please give it
> a try.

Thanks, cygpath seems to fixed.
However, my perl tests still don't run through.

1) cygwin_internal(CW_GET_CYGDRIVE_INFO, user, system, user_flags, 
system_flags);
is a little bit different from 1.5

1.5 returns in user resp. system "/cygdrive",
but 1.7 returns "/cygdrive/"
This is annoying.

1.5$ perl -e'print Cygwin::mount_flags("/cygdrive")'
binmode,cygdrive,/cygdrive
1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
binmode,cygdrive,/cygdrive/

2) multibyte chars in pathnames are not printed with /bin/ls.
Not in cmd.exe + bash and not in rxvt+bash.
cmd.exe alone prints it fine.

   # mkdir 'Äëä'
   perl -e'$s=sprintf "\x{c4}\x{eb}\x{e4}"; mkdir $s;'
   ls
=>
   ???
   dir
=>
   \304\353\344

bash or coreutils?

PS:
The mnt->mnt_type change from system to now ntfs is fine with me.

1.7$ perl -e'$,="\t"; print @$_,"\n" for Cygwin::mount_table'
/usr/bin        C:\cygwin-1.7\bin       ntfs    binmode,system
/usr/lib        C:\cygwin-1.7\lib       ntfs    binmode,system
/       C:\cygwin-1.7   ntfs    binmode,system
/cygdrive/c     c:      ntfs    binmode,noumount,user

1.5$ perl -e'$,="\t"; print @$_,"\n" for Cygwin::mount_table'
/usr/bin        f:\cygwin\bin   system  binmode
/usr/lib        f:\cygwin\lib   system  binmode
/       f:\cygwin       system  binmode
/cygdrive/c     c:      system  binmode,noumount

-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 13:04     ` Reini Urban
@ 2008-06-13 13:14       ` Eric Blake
  2008-06-13 14:19         ` Corinna Vinschen
  2008-06-13 14:31       ` Corinna Vinschen
  1 sibling, 1 reply; 16+ messages in thread
From: Eric Blake @ 2008-06-13 13:14 UTC (permalink / raw)
  To: cygwin-apps

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Reini Urban on 6/13/2008 7:03 AM:
| 1.5 returns in user resp. system "/cygdrive",
| but 1.7 returns "/cygdrive/"
| This is annoying.

But is it wrong?  On the other hand, what happens if the user has / as
their cygdrive; does this print //?

| 2) multibyte chars in pathnames are not printed with /bin/ls.
| bash or coreutils?

Probably coreutils, and probably because isprint() is returning false.  In
1.5.x, I hacked coreutils to print non-ASCII characters in spite of
isprint() returning false, but I think that hack disappeared in my porting
to 1.7.0.  At any rate, I think that isprint() should be fixed here rather
than hacking coreutils - if the console can display something reasonable
for characters >= 0x80, then isprint() should claim they are printable.
But some of this also depends on deciding sane semantics for unibyte vs.
multibyte character locale settings.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhScn0ACgkQ84KuGfSFAYCYaQCgpmEs74b7Q5wBVDtdPIyxuQAn
428AoIdyL8mTew5Gvoi5kZW8h1xtA2FA
=FIqi
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 13:14       ` Eric Blake
@ 2008-06-13 14:19         ` Corinna Vinschen
  2008-06-13 15:23           ` Corinna Vinschen
  0 siblings, 1 reply; 16+ messages in thread
From: Corinna Vinschen @ 2008-06-13 14:19 UTC (permalink / raw)
  To: cygwin-apps

On Jun 13 07:13, Eric Blake wrote:
> According to Reini Urban on 6/13/2008 7:03 AM:
> | 1.5 returns in user resp. system "/cygdrive",
> | but 1.7 returns "/cygdrive/"
> | This is annoying.
>
> But is it wrong?  On the other hand, what happens if the user has / as
> their cygdrive; does this print //?

I'll look into that.

> | 2) multibyte chars in pathnames are not printed with /bin/ls.
> | bash or coreutils?
>
> At any rate, I think that isprint() should be fixed here rather
> than hacking coreutils - if the console can display something reasonable
> for characters >= 0x80, then isprint() should claim they are printable.
> But some of this also depends on deciding sane semantics for unibyte vs.
> multibyte character locale settings.

Indeed!  However, right now ls will print the correct filename regardless
of the codepage used.  "Right now", because I still hope that Kadzuhiro
will come up with the NLS-related changes discussed on cygwin-developers
which obsoletes the CYGWIN=codepage setting in favor of LC_CTYPE et al.

  1.7$ export CYGWIN=codepage:ansi
  1.7$ ls -b
  \304\353\344
  1.7$ ls --show-control-chars
  Äëä
  1.7$ export CYGWIN=codepage:utf8
  1.7$ ls -b
  \303\204\303\253\303\244
  1.7$ ls --show-control-chars
  Äëä


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 13:04     ` Reini Urban
  2008-06-13 13:14       ` Eric Blake
@ 2008-06-13 14:31       ` Corinna Vinschen
  2008-06-13 14:41         ` Christopher Faylor
  2008-06-13 15:02         ` Reini Urban
  1 sibling, 2 replies; 16+ messages in thread
From: Corinna Vinschen @ 2008-06-13 14:31 UTC (permalink / raw)
  To: cygwin-apps

On Jun 13 15:03, Reini Urban wrote:
> 1.5$ perl -e'print Cygwin::mount_flags("/cygdrive")'
> binmode,cygdrive,/cygdrive
> 1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
> binmode,cygdrive,/cygdrive/

Doesn't work for me:

  1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
  Undefined subroutine &Cygwin::mount_flags called at -e line 1.

How does a standalone example look like?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 14:31       ` Corinna Vinschen
@ 2008-06-13 14:41         ` Christopher Faylor
  2008-06-13 14:51           ` Corinna Vinschen
  2008-06-13 15:07           ` Reini Urban
  2008-06-13 15:02         ` Reini Urban
  1 sibling, 2 replies; 16+ messages in thread
From: Christopher Faylor @ 2008-06-13 14:41 UTC (permalink / raw)
  To: cygwin-apps

On Fri, Jun 13, 2008 at 04:30:51PM +0200, Corinna Vinschen wrote:
>On Jun 13 15:03, Reini Urban wrote:
>> 1.5$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>> binmode,cygdrive,/cygdrive
>> 1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>> binmode,cygdrive,/cygdrive/
>
>Doesn't work for me:
>
>  1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>  Undefined subroutine &Cygwin::mount_flags called at -e line 1.
>
>How does a standalone example look like?

Don't you need a -MCygwin on the perl command line?

cgf

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 14:41         ` Christopher Faylor
@ 2008-06-13 14:51           ` Corinna Vinschen
  2008-06-13 15:07           ` Reini Urban
  1 sibling, 0 replies; 16+ messages in thread
From: Corinna Vinschen @ 2008-06-13 14:51 UTC (permalink / raw)
  To: cygwin-apps

On Jun 13 10:41, Christopher Faylor wrote:
> On Fri, Jun 13, 2008 at 04:30:51PM +0200, Corinna Vinschen wrote:
> >On Jun 13 15:03, Reini Urban wrote:
> >> 1.5$ perl -e'print Cygwin::mount_flags("/cygdrive")'
> >> binmode,cygdrive,/cygdrive
> >> 1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
> >> binmode,cygdrive,/cygdrive/
> >
> >Doesn't work for me:
> >
> >  1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
> >  Undefined subroutine &Cygwin::mount_flags called at -e line 1.
> >
> >How does a standalone example look like?
> 
> Don't you need a -MCygwin on the perl command line?

Doesn't work for me either:

  Can't locate Cygwin.pm in @INC (@INC contains: /usr/lib/perl5/5.8/cygwin
  /usr/lib/perl5/5.8 /usr/lib/perl5/site_perl/5.8/cygwin
  /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/site_perl/5.8
  /usr/lib/perl5/vendor_perl/5.8/cygwin /usr/lib/perl5/vendor_perl/5.8
  /usr/lib/perl5/vendor_perl/5.8 .).

I noticed that Cygwin.pm is in /usr/lib/perl5/5.8/File/Spec.  I added
this path to the environment variable PERL5LIB, but it didn't help
either:

  Undefined subroutine &Cygwin::mount_flags called at -e line 1.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 14:31       ` Corinna Vinschen
  2008-06-13 14:41         ` Christopher Faylor
@ 2008-06-13 15:02         ` Reini Urban
  2008-06-13 15:15           ` Corinna Vinschen
  1 sibling, 1 reply; 16+ messages in thread
From: Reini Urban @ 2008-06-13 15:02 UTC (permalink / raw)
  To: cygwin-apps

Corinna Vinschen schrieb:
> On Jun 13 15:03, Reini Urban wrote:
>> 1.5$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>> binmode,cygdrive,/cygdrive
>> 1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>> binmode,cygdrive,/cygdrive/
> 
> Doesn't work for me:
> 
>   1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>   Undefined subroutine &Cygwin::mount_flags called at -e line 1.
> 
> How does a standalone example look like?

Sorry, this perl is perl5.10.0-4 from [Exp].
Also I recompiled it for cygwin-1.7 with the wchar support. (returning 
utf8 converted from wchar)
perl5.8.8 doesn't has this function yet.

Something like:

#include <stdlib.h>
#include <stdio.h>
#include <sys/cygwin.h>

char *Cygwin_mount_flags(char *pathname) {

     char flags[260]; /* I know, I know. stack vs heap */

     /* TODO: Check for cygdrive registry setting,
      *       and then use CW_GET_CYGDRIVE_INFO
      */
     if (!strcmp(pathname, "/cygdrive")) {
	char user[260];
	char system[260];
	char user_flags[260];
	char system_flags[260];

	cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system, user_flags,
			 system_flags);

         if (strlen(user) > 0) {
             sprintf(flags, "%s,cygdrive,%s", user_flags, user);
         } else {
             sprintf(flags, "%s,cygdrive,%s", system_flags, system);
         }

	return flags;

     } else {
	struct mntent *mnt;
	setmntent (0, 0);
	while ((mnt = getmntent (0))) {
	    if (!strcmp(pathname, mnt->mnt_dir)) {
		strcpy(flags, mnt->mnt_type);
		if (strlen(mnt->mnt_opts) > 0) {
		    strcat(flags, ",");
		    strcat(flags, mnt->mnt_opts);
		}
		break;
	    }
	}
	endmntent (0);

	return flags;
     }
}


-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 14:41         ` Christopher Faylor
  2008-06-13 14:51           ` Corinna Vinschen
@ 2008-06-13 15:07           ` Reini Urban
  1 sibling, 0 replies; 16+ messages in thread
From: Reini Urban @ 2008-06-13 15:07 UTC (permalink / raw)
  To: cygwin-apps

Christopher Faylor schrieb:
> On Fri, Jun 13, 2008 at 04:30:51PM +0200, Corinna Vinschen wrote:
>> On Jun 13 15:03, Reini Urban wrote:
>>> 1.5$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>>> binmode,cygdrive,/cygdrive
>>> 1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>>> binmode,cygdrive,/cygdrive/
>> Doesn't work for me:
>>
>>  1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>>  Undefined subroutine &Cygwin::mount_flags called at -e line 1.
>>
>> How does a standalone example look like?
> 
> Don't you need a -MCygwin on the perl command line?

No.
cygwin perl has all Cygwin functions always in core.
It's no module (yet).
For more advanced Cygwin functions like access to
cygwin_internal() I thought of an CPAN module sooner or later.
-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 15:02         ` Reini Urban
@ 2008-06-13 15:15           ` Corinna Vinschen
  2008-06-13 15:19             ` Corinna Vinschen
  0 siblings, 1 reply; 16+ messages in thread
From: Corinna Vinschen @ 2008-06-13 15:15 UTC (permalink / raw)
  To: cygwin-apps

On Jun 13 17:01, Reini Urban wrote:
> Corinna Vinschen schrieb:
>> On Jun 13 15:03, Reini Urban wrote:
>>> 1.5$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>>> binmode,cygdrive,/cygdrive
>>> 1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>>> binmode,cygdrive,/cygdrive/
>> Doesn't work for me:
>>   1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
>>   Undefined subroutine &Cygwin::mount_flags called at -e line 1.
>> How does a standalone example look like?
>
> Sorry, this perl is perl5.10.0-4 from [Exp].
> Also I recompiled it for cygwin-1.7 with the wchar support. (returning utf8 
> converted from wchar)
> perl5.8.8 doesn't has this function yet.
>
> Something like:

Thanks.  Is that the function implemented in Perl?  If so, I'd have
two comments:

> #include <stdlib.h>
> #include <stdio.h>
> #include <sys/cygwin.h>
>
> char *Cygwin_mount_flags(char *pathname) {
>
>     char flags[260]; /* I know, I know. stack vs heap */
>
>     /* TODO: Check for cygdrive registry setting,
>      *       and then use CW_GET_CYGDRIVE_INFO
>      */

Drop that TODO.  Never test the registry, not even in 1.5, even less
in 1.7.

>     if (!strcmp(pathname, "/cygdrive")) {
> 	char user[260];
> 	char system[260];
> 	char user_flags[260];
> 	char system_flags[260];

The paths in user and system are potentially PATH_MAX bytes long.
That's 4K in 1.7.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 15:15           ` Corinna Vinschen
@ 2008-06-13 15:19             ` Corinna Vinschen
  2008-06-13 16:56               ` Reini Urban
  0 siblings, 1 reply; 16+ messages in thread
From: Corinna Vinschen @ 2008-06-13 15:19 UTC (permalink / raw)
  To: cygwin-apps

On Jun 13 17:14, Corinna Vinschen wrote:
> > char *Cygwin_mount_flags(char *pathname) {
> >
> >     char flags[260]; /* I know, I know. stack vs heap */
> > [...]
> >     return flags;

And it's returning the content of a local buffer.  Ouch!


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 14:19         ` Corinna Vinschen
@ 2008-06-13 15:23           ` Corinna Vinschen
  0 siblings, 0 replies; 16+ messages in thread
From: Corinna Vinschen @ 2008-06-13 15:23 UTC (permalink / raw)
  To: cygwin-apps

On Jun 13 16:18, Corinna Vinschen wrote:
> On Jun 13 07:13, Eric Blake wrote:
> > According to Reini Urban on 6/13/2008 7:03 AM:
> > | 1.5 returns in user resp. system "/cygdrive",
> > | but 1.7 returns "/cygdrive/"
> > | This is annoying.
> >
> > But is it wrong?  On the other hand, what happens if the user has / as
> > their cygdrive; does this print //?
> 
> I'll look into that.

I've applied a fix.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 15:19             ` Corinna Vinschen
@ 2008-06-13 16:56               ` Reini Urban
  2008-06-13 17:26                 ` Corinna Vinschen
  0 siblings, 1 reply; 16+ messages in thread
From: Reini Urban @ 2008-06-13 16:56 UTC (permalink / raw)
  To: cygwin-apps, cygwin

2008/6/13 Corinna Vinschen:
> On Jun 13 17:14, Corinna Vinschen wrote:
>> > char *Cygwin_mount_flags(char *pathname) {
>> >
>> >     char flags[260]; /* I know, I know. stack vs heap */
>> > [...]
>> >     return flags;
>
> And it's returning the content of a local buffer.  Ouch!

It was just an example. The real perl function is correct of course.

>>       char user[260];
>>       char system[260];
>>       char user_flags[260];
>>       char system_flags[260];

>The paths in user and system are potentially PATH_MAX bytes long.
>That's 4K in 1.7.

Thank for the PATH_MAX hint. I almost forgot that.

>>     /* TODO: Check for cygdrive registry setting,
>>      *       and then use CW_GET_CYGDRIVE_INFO
>>      */

>Drop that TODO.  Never test the registry, not even in 1.5, even less
>in 1.7.

To explain:
For now I had the semantic limitation that the magic
  Cygwin::mount_flags("/cygdrive")
is required to return the volume mount settings.
But when a user mounted it to somewhere else, say "/mnt", then
the result for Cygwin::mount_flags("/mnt") might not be what he/she
expected. So the TODO is to check if "/mnt" is the current volume
mount point, and return the volume mount point flags then.

Changed to
    /* TODO: Check if arg is the current volume moint point if not default,
     *       and then use CW_GET_CYGDRIVE_INFO also.
     */
The next perl-5.10 version (this time for cygwin 1.7) will have
this TODO actually implemented.

From README.cygwin:
=item C<Cygwin::mount_flags>

Returns the mount type and flags for a specified mount point.
A comma-separated string of mntent->mnt_type (always
"system" or "user"), then the mntent->mnt_opts, where
the first is always "binmode" or "textmode".

  system|user,binmode|textmode,exec,cygexec,cygdrive,mixed,
  notexec,managed,nosuid,devfs,proc,noumount

If the argument is "/cygdrive" or equal to the current cygdrive mount
prefix, then just the volume mount settings, and the cygdrive mount
prefix are returned.

User mounts override system mounts.

  $ perl -e 'print Cygwin::mount_flags "/usr/bin"'
  system,binmode,cygexec
  $ perl -e 'print Cygwin::mount_flags "/cygdrive"'
  binmode,cygdrive,/cygdrive

-- 
Reini Urban
http://phpwiki.org/ http://murbreak.at/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: cygpath 1.7 wrong
  2008-06-13 16:56               ` Reini Urban
@ 2008-06-13 17:26                 ` Corinna Vinschen
  0 siblings, 0 replies; 16+ messages in thread
From: Corinna Vinschen @ 2008-06-13 17:26 UTC (permalink / raw)
  To: cygwin-apps

On Jun 13 18:56, Reini Urban wrote:
> For now I had the semantic limitation that the magic
>   Cygwin::mount_flags("/cygdrive")
> is required to return the volume mount settings.
> But when a user mounted it to somewhere else, say "/mnt", then
> the result for Cygwin::mount_flags("/mnt") might not be what he/she
> expected. So the TODO is to check if "/mnt" is the current volume
> mount point, and return the volume mount point flags then.
> 
> Changed to
>     /* TODO: Check if arg is the current volume moint point if not default,
>      *       and then use CW_GET_CYGDRIVE_INFO also.
>      */
> The next perl-5.10 version (this time for cygwin 1.7) will have
> this TODO actually implemented.

How do you check for the cygdrive?  I'm wondering if this shouldn't
be the other way around, something along these lines:

  cygwin_internal (CW_GET_CYGDRIVE_INFO);
  cygdrive_prefix = user[0] ? user : system;
  len = strlen (cygdrive_prefix);
  if (!strncmp (incoming_path, cygdrive_prefix, len)
      && incoming_path[len] == '/')
    // cygdrive, we have all info
  else
    // Do the getmntent chores


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-06-13 17:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-03 20:15 cygpath 1.7 wrong Reini Urban
2008-06-09 14:24 ` Corinna Vinschen
2008-06-13  8:29   ` Corinna Vinschen
2008-06-13 13:04     ` Reini Urban
2008-06-13 13:14       ` Eric Blake
2008-06-13 14:19         ` Corinna Vinschen
2008-06-13 15:23           ` Corinna Vinschen
2008-06-13 14:31       ` Corinna Vinschen
2008-06-13 14:41         ` Christopher Faylor
2008-06-13 14:51           ` Corinna Vinschen
2008-06-13 15:07           ` Reini Urban
2008-06-13 15:02         ` Reini Urban
2008-06-13 15:15           ` Corinna Vinschen
2008-06-13 15:19             ` Corinna Vinschen
2008-06-13 16:56               ` Reini Urban
2008-06-13 17:26                 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).