Thanks to Jan Dubois again for helping with some quirks.
Unrelated, but near:
Someone questioned the two complementary functions is_binmount() and
is_textmount() as bloat.
is_textmount() is more readable than !is_binmount()
Not everyone knows that there only exist such two kinds of special
cygwin mount handling for CRLF massage.
And who knows, maybe later some years will arrive a Mac-system friendly
text handling?
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/
http://helsinki.at/ http://spacemovie.mur.at/
Thanks, applied. (#31708)
-- ams
I don't have a cygwin to try with at the moment, but how does this
handle it when there's both a user and a system mount for the same
path? (I forget which takes precedence.)
This is explained in the README.
=item C<Cygwin::mount_flags>
Returns the mount type and flags for a specified mount point.
A comma-seperated 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", just the volume mount settings 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
Sorry, I meant to be asking about mount_table. Does it return
both the system and user entries if there are both for the same
path?
Ah, sorry. I mixed that up.
With mount_table() the user entries are always listed BEFORE system
entries. This is especially sorted to avoid discrepancies.
With mount_flags() I do it manually to match mount_table().
Cygwin::mount_table always matches the output of /usr/bin/mount.
We just spare the system call and avoid string splitting.
That's why into CORE and not as some CPAN module.
$ mount -m
mount -f -s -b -X "f:/cygwin/bin" "/bin"
mount -f -s -b "f:/cygwin/bin" "/usr/bin"
mount -f -s -b "f:/cygwin/lib" "/usr/lib"
mount -f -s -b "f:/cygwin" "/"
mount -f -u -t "e:/tmp" "/texttest"
mount -s -b --change-cygdrive-prefix "/cygdrive"
$ mount -f -u -b "f:/cygwin/lib" "/usr/lib"
$ mount
f:\cygwin\bin on /bin type system (binmode,cygexec
f:\cygwin\bin on /usr/bin type system (binmode)
f:\cygwin\lib on /usr/lib type user (binmode)
f:\cygwin\lib on /usr/lib type system (binmode)
f:\cygwin on / type system (binmode)
e:\tmp on /texttest type user (textmode)
c: on /cygdrive/c type system (binmode,noumount)
d: on /cygdrive/d type system (binmode,noumount)
e: on /cygdrive/e type system (binmode,noumount)
f: on /cygdrive/f type system (binmode,noumount)
h: on /cygdrive/h type system (binmode,noumount)
i: on /cygdrive/i type system (binmode,noumount)
m: on /cygdrive/m type system (binmode,noumount)
n: on /cygdrive/n type system (binmode,noumount)
p: on /cygdrive/p type system (binmode,noumount)
r: on /cygdrive/r type system (binmode,noumount)
s: on /cygdrive/s type system (binmode,noumount)
u: on /cygdrive/u type system (binmode,noumount)
v: on /cygdrive/v type system (binmode,noumount)
w: on /cygdrive/w type system (binmode,noumount)
$ perlblead -e 'for $i (Cygwin::mount_table) {print join(" ",@$i),"\n";}'
/bin f:\cygwin\bin system binmode,cygexec
/usr/bin f:\cygwin\bin system binmode
/usr/lib f:\cygwin\lib user binmode
/usr/lib f:\cygwin\lib system binmode
/ f:\cygwin system binmode
/texttest e:\tmp user textmode
/cygdrive/c c: system binmode,noumount
/cygdrive/d d: system binmode,noumount
/cygdrive/e e: system binmode,noumount
/cygdrive/f f: system binmode,noumount
/cygdrive/h h: system binmode,noumount
/cygdrive/i i: system binmode,noumount
/cygdrive/m m: system binmode,noumount
/cygdrive/n n: system binmode,noumount
/cygdrive/p p: system binmode,noumount
/cygdrive/r r: system binmode,noumount
/cygdrive/s s: system binmode,noumount
/cygdrive/u u: system binmode,noumount
/cygdrive/v v: system binmode,noumount
/cygdrive/w w: system binmode,noumount
This might be a good idea:
--- perl-current/t/lib/cygwin.t.orig 2007-08-16 13:19:44.000000000 -0700
+++ perl-current/t/lib/cygwin.t 2007-08-16 13:21:23.000000000 -0700
@@ -57,5 +57,6 @@
for $i (@mnttbl) {
if ($i->[0] eq '/') {
is($i->[2].",".$i->[3], $rootmnt, "same root mount flags");
+ last;
}
}
Yes, please.
There might be two.
Thanks, applied as #31760.