Cygwin Issues: Difference between revisions

Converted most markup. Layout needs fixing at places
[unchecked revision][unchecked revision]
mNo edit summary
(Converted most markup. Layout needs fixing at places)
Line 48:
==== case-insensitive search ====
 
Windows filesystems are usually case-insensitive in search, but case-preservant (I know of 5 windows fs in general use, NTFS5 as
best, a new one on the horizon). For POSIX compatibility there's no optional option or flag to restrict searches (open,fopen,readdir,unlink,rename,...) to be case-sensitive.
case-preservant (I know of 5 windows fs in general use, NTFS5 as
You can only tell your filesystem to be case-sensitive (somewhere in the registry, which is not recommended and unrealistic), use
best, a new one on the horizon). For POSIX compatibility there's no
special cygwin managed mounts (<code>mount -o managed</code>) or check case-sensitivity explicitly in your code. Best is to avoid such issues beforehand, not allowing only case-different filenames.
optional option or flag to restrict searches
:But with user-created plugins it will get complicated.
(open,fopen,readdir,unlink,rename,...) to be case-sensitive. %%%
You can only tell your filesystem to be case-sensitive (somewhere
in the registry, which is not recommended and unrealistic), use
special cygwin managed mounts (<code>mount -o managed</code>) or check
case-sensitivity explicitly in your code. Best is to avoid such
issues beforehand, not allowing only case-different filenames.
But with user-created plugins it will get complicated.
 
_TimRobinson:TimRobinson: it's possible to get Windows to use case-sensitive lookups
at the kernel level, which is how psxss.exe and Interix work. But doing so
can confuse Win32 apps, which clearly don't distinguish case._:
_Exercise:Exercise: Get hold of the Windows Resource Kit. Create a two files file
using the cat.exe included, whose names differ only by case. Delete them by
name using the del command._
Line 73 ⟶ 67:
is resolved, before going to the parent directory.
Cygwin is blindly collapsing <tt>dir/..</tt> into nothing, without first verifying dir, in
violation of POSIX. (_Eric''Eric Blake_Blake'') %%%
It will probably keep this behaviour due to performance reasons. (_cgf_''cgf'') %%%
http://cygwin.com/ml/cygwin/2005-04/msg00380.html
 
=== unlink() ===
* unlink isn't atomic (as on other platforms also)
:<code> while (!unlink(..) or end-of-waiting()) { sleep; } </code>
:On cygwin <tt>unlink()</tt> is deferred to the end of the process, when unlink fails because of locks or delete on close (<tt>ERROR_SHARING_VIOLATION</tt>).
 
* unlink a file and subsequent creation of a new file in the same location is not supported.
<code> while (!unlink(..) or end-of-waiting()) { sleep; } </code>
 
* unlink(2) doesn't do traverse security checks:
On cygwin =unlink()= is deferred to the end of the process,
:cygwin unlink() still has the POSIX bug I reported earlier where calling unlink() on a file in a directory with no write permissions still removes the file, thanks to the underlying Windows implementation. Worse, because the directory has no write permissions, you can't directly re-create a new file to replace the one that was erroneously deleted. But Chris already argued that checking for write permissions on the parent directory as part of every unlink() call would slow down the common case. - EricBlake
when unlink fails because of locks or delete on close
:http://sourceware.org/ml/cygwin/2005-04/msg00552.html
(=ERROR_SHARING_VIOLATION=).
 
* "delete on close" (unlinking an open file) is supported.
* unlink a file and subsequent creation of a new file
:(definitive answer: => ''pierre'')
in the same location is not supported.
 
* unlink(2) doesn't do traverse security checks:
 
_cygwin unlink() still has the POSIX bug I reported earlier
where calling unlink() on a file in a directory with no write permissions
still removes the file, thanks to the underlying Windows implementation.
Worse, because the directory has no write permissions, you can't directly
re-create a new file to replace the one that was erroneously deleted. But
Chris already argued that checking for write permissions on the parent
directory as part of every unlink() call would slow down the common case._ EricBlake
http://sourceware.org/ml/cygwin/2005-04/msg00552.html ...
 
* "delete on close" (unlinking an open file) is supported.
 
(_definitive answer: => pierre_)
 
=== Passing file descriptors ===
* You generally cannot pass file descriptors between seperate processes. See http://www.cygwin.com/ml/cygwin-patches/2002-q3/msg00003.html for description and workarounds. Passing the handle via IPC, passing handles to ~MapViewOfFile, ...
See http://www.cygwin.com/ml/cygwin-patches/2002-q3/msg00003.html
for description and workarounds. Passing the handle via IPC,
passing handles to ~MapViewOfFile, ...
 
=== Hardlinks ===
* hardlinking directories is only available to the superuser
:<code>ln -d</code>, ...
* *junctions* (NTFS4 directory mount points and NTFS5 volume mount points via Reparse Points) are almost equivalent to symlinks, but symlinks are implemented in cygwin differently and slower and do work on filenames and non-local volumes also.
are almost equivalent to symlinks, but symlinks are implemented in cygwin differently and
slower and do work on filenames and non-local volumes also.
 
=== mount ===
* Mounting filesystems and devices are not supported. %%%
:The =<tt>/usr/bin/mount=</tt> syntax is similar but different to your favorite mount. See =<tt>mount -m=</tt>.
 
* /etc/mtab is not linked to /proc/mounts. /proc/mount is not yet implemented, but a
:/proc/mount is not yet implemented, but a few other procfs files are:
<pre> $ ls /proc
<cyg-pids/...> cpuinfo meminfo registry/ uptime loadavg partitions stat version </pre>
 
=== Device limitations TODO ===
Explain about our device mapping, special block/char devices, other magic devices like sockets, fifo's, ... /dev/dsp and other audio devices do work. Serial devices have some known limitations. Igor's /usr/sbin/create_devices.sh helper (ml-url?)
other magic devices like sockets, fifo's, ... %%%
/dev/dsp and other audio devices do work. %%%
Serial devices have some known limitations. %%%
Igor's /usr/sbin/create_devices.sh helper (ml-url?)
 
=== Special filenames ===
 
See http://cygwin.com/cygwin-ug-net/using-specialnames.html
 
* using (esp. unlinking) <code>"NUL"</code> and other special filenames is problematic (see FAQ and windows-special <code>"\\.\"</code> and <code>"\??\"</code> path-prefixes on Windows).
problematic (see FAQ and windows-special :<code>"DEL \\.\c:\somedir\nul"</code> and
:There was a cygwin1.dll patch by Pierre which allows deleting such accidently created files.
<code>"\??\"</code> path-prefixes on Windows).
<code>"DEL \\.\c:\somedir\nul"<code>
There was a cygwin1.dll patch by Pierre which allows deleting such accidently created files.
 
=== getfacl/setfacl ===
See user guide ( http://www.cygwin.com/cygwin-ug-net/using-utils.html : [ setfacl | http://www.cygwin.com/cygwin-ug-net/using-utils.html#setfacl ] / [ getfacl | http://www.cygwin.com/cygwin-ug-net/using-utils.html#getfacl ] ) %%%
: cygwin ACL's are not 1:1 mapped to windows ACL's, esp. for inherited directory permissions. (?)
esp. for inherited directory permissions. (?) %%%
TODO
 
'''TODO'''
(_definitive answer: => corrinna_)
:(''definitive answer: => corrinna'')
 
=== select() ===
* http://cygwin.com/cygwin-ug-net/highlights.html#OV-HI-SELECT is outdated. (cgf)
* select with write-to-pipe fails sometimes (rsync). See http://sourceware.org/bugzilla/show_bug.cgi?id=478
* '''TODO''' (_definitive''definitive answer: => cgf_cgf'')
 
=== sync() ===
* sync() is a no-op (although it's possible on Windows, see [http://msdn.microsoft.com/library/en-us/fileio/base/flushfilebuffers.asp] - the part beginning with "To flush all open files on a volume" - and [http://www.sysinternals.com/ntw2k/source/misc.shtml#sync] for a tool that makes use of it), and as specified by the standard it's unclear whether it's even supposed to do anything (all cache managers eventually flush dirty pages...).
* fsync() works as expected.
 
== Security ==
 
See http://cygwin.com/cygwin-ug-net/ntsec.html, http://cygwin.com/faq/faq_3.html#SEC78, sysbash, network shares, samba, windows profiles, ... Of course cygwin is entirely insecure.
sysbash, network shares, samba, windows profiles, ... %%%
Of course cygwin is entirely insecure.
 
=== setuid/su/login/cron ===
* UNIX root uid is 0, Windows SYSTEM uid is 18.
 
* UNIXcygwin rootcron uidusually isruns 0,as Windowsuser SYSTEM uidand istherefore 18...
:(network shares, file permissions, ...) TODO
* cygwin cron usually runs as user SYSTEM and therefore ...
* TODO: setuid,setgid file permission flag and workarounds.
(network shares, file permissions, ...) TODO
* TODO: setuid,()/setgid() file permission flag andprocess workarounds.
:see http://cygwin.com/cygwin-ug-net/ntsec.html#NTSEC-SETUID
* setuid()/setgid() process workarounds.
* TODO: setsid()/setpgid(): ??
see http://cygwin.com/cygwin-ug-net/ntsec.html#NTSEC-SETUID
* TODO: setsid()/setpgid():su, sudo vs runas ??...
* TODO: su,login sudo vs runas ...limitations
* TODO: login limitations
 
== Processes ==
 
See the user-guide on fork, IPC, ... %%%(''definitive answers: => cgf'')
(_definitive answers: => cgf_)
 
=== fork ===
Works as expected. %%%
:See http://cygwin.com/faq/faq_3.html#SEC74 and http://cygwin.com/cygwin-ug-net/highlights.html#OV-HI-PROCESS
http://cygwin.com/cygwin-ug-net/highlights.html#OV-HI-PROCESS
 
=== PID ===
* Unfortunately cygwin must use seperate PID's than the underlying windows PID's. %%%
:http://cygwin.com/cygwin-ug-net/highlights.html#OV-HI-PROCESS is outdated. (cgf)
 
=== IPC ===
* Requires the *cygserver* daemon (which requires the string "server" in $CYGWIN).
:ipc-daemon2 is outdated and should be uninstalled. Unless you still use postgresql 7.4.3 or other dependent packages.
Unless you still use postgresql 7.4.3 or other dependent packages.
* IPC is not fully supported on Win95 yet, due to known cygserver problems.
:TODO (fixed in which snapshot, when?)
 
=== Threads ===
1.5.11 was rather unstable compared to 1.5.10.
 
* <code>-lpthread</code> is supported by cygwin1.dll, libpthread.a is just an import library.
* PROCESS_SHARED objects may not work (?, R.Collins, April 2001)
* pshared mutexs (?)
* signals cannot interrupt semaphores: <code>semaphore::_trywait</code>
* as always: The latest snapshot might have fixed it :)
 
=== DLL ===
See http://cygwin.com/cygwin-ug-net/dll.html and http://cygwin.com/faq/faq_3.html#SEC108
 
http://cygwin.com/faq/faq_3.html#SEC108 %%%
Use gcc -shared or libtool, or the older helpers dlltool, dllwrap.
 
* All exported symbols must be relocatable and known at compile-time.
:Unless on unix, where they will be resolved at load-time ("lazy").
 
* Building a .dll might require more steps than building an .so
:(unless you use the simple =<tt>gcc -shared=</tt> of course). Google for "Microsoft designers must have been on crack", might need special MSVC-like __declspec IMPORT/EXPORT declarations, but better use the linker %%%methods.
:We use specially named import libraries named like "lib<package>-version>.dll.a", The shared libs like "cyg<package>-<version>.dll", and must reside in the PATH!
Google for "Microsoft designers must have been on crack",
:Most packagers just forget the required <code>-no-undefined</code> libtool switch.
might need special MSVC-like __declspec IMPORT/EXPORT declarations,
:DATA sections (structs, classes) to be exported from DLL's will best work with this linker switch: <code> -Wl,--enable-runtime-pseudo-reloc </code>
but better use the linker methods.
 
We use specially named import libraries named like "lib<package>-version>.dll.a",
The shared libs like "cyg<package>-<version>.dll",
and must reside in the PATH!
 
Most packagers just forget the required <code>-no-undefined</code> libtool switch.
 
DATA sections (structs, classes) to be exported from DLL's will best work with
this linker switch: %%%
<code> -Wl,--enable-runtime-pseudo-reloc </code>
 
* Importing symbols from .exe's will not work, unlike on linux or solaris.
:you can only import from dll's. %%%
:See http://cygwin.com/ml/cygwin/2002-11/msg00615.html and http://cygwin.com/ml/cygwin/2004-10/msg00339.html
and http://cygwin.com/ml/cygwin/2004-10/msg00339.html
 
* Lazy linking is not yet supported by gcc.
:See wine and MSVC. (Info for windows folks only)
 
=== getloadavg() missing ===
* <code>getloadavg()</code> is still a noop on windows. No one came up with a comparable solution yet.
:It is used by make, xemacs, top, ...
 
=== Console ===
Line 250 ⟶ 202:
* pty / tty issues: http://www.khngai.com/emacs/tty.php
* pipes TODO (known problems with text/binmode issues, which should have been fixed in a snapshot.)
:See also select() above.
* bash PID reuse problem was fixed by bash-2.05b-16. %%%
:(TODO: ml-url)
* Foreign characters support:
:cygwin does NOT support UTF-8 nor UTF-16 yet, since newlib doesn't support it. Use better terms, CYGWIN="codepage:oem"
Use better terms, CYGWIN="codepage:oem"
 
== Other magic good to know ==
 
* *winsock* requires the 'SYSTEMROOT' environment variable setting. CGI might fail. Fixed since 1.3.14.
:http://article.gmane.org/gmane.os.cygwin/55115 Reason: cygwin uses the windows socket library.
Reason: cygwin uses the windows socket library.
 
:Workaround for Apache: %%%~SetEnv SYSTEMROOT "<path-to-c-windows>"
~SetEnv SYSTEMROOT "<path-to-c-windows>"
 
* setup --help (as of v2.427) does print its options, but to ./setup.log not to STDOUT.
:setup --help; tail setup.log
 
setup --help; tail setup.log
1,490

edits