This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: cygpath 1.7 wrong
- From: "Reini Urban" <rurban at x-ray dot at>
- To: cygwin-apps at cygwin dot com, cygwin at cygwin dot com
- Date: Fri, 13 Jun 2008 18:56:14 +0200
- Subject: Re: cygpath 1.7 wrong
- References: <4845A725.4090706@x-ray.at> <20080609142427.GW731@calimero.vinschen.de> <20080613082926.GM731@calimero.vinschen.de> <48527025.3080709@x-ray.at> <20080613143051.GP731@calimero.vinschen.de> <48528BCB.1000009@x-ray.at> <20080613151439.GR731@calimero.vinschen.de> <20080613151927.GS731@calimero.vinschen.de>
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/
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/