From: michael AT weiser DOT saale-net DOT de (Michael Weiser) Subject: gnuwin32 mini FAQ and resource pointer 2 Dec 1998 10:51:55 -0800 Message-ID: <36694d02.7144062.cygnus.gnu-win32@mail.weiser.saale-net.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit To: gnu-win32 AT cygnus DOT com Hello Folks, This time I'm posting the FAQ by hand since I tried to update it to B20 and want to give out a beta version for getting some definitive answers from the developers on topics I'm uncertain about. So the following is _not_ neccessarily perfect and correct! Don't rely on it if you're not certain about what to do! (Saying: This time it's even more AS IS then normally. :) Unfortunately I only have mail connectivity at the moment and thus have to ask some things I could easily prove myself. I'm really sorry about that and working hard on getting connected again! :-/ So first the questions and then the FAQ: 1. Is Sergey's cygwin32 b19.3 coolview still available somewhere? 2. How does binmode affect ///-like paths in B20? Does it switch them to binary mode like B19 didn't? At least on my vanilla full.exe (Nov 2) such paths seem to default to binary mode regardless of the binmode setting. 3. Were ///-like paths really in text mode on B19? I'm not quite sure about that but think to remember a discussion on the list stating just that. 4. Could someone with more knowledge than me read sections 1.1.1. and 1.1.4. really carefully? There are some statements that are very definitve although I'm not quite sure that they're really true. The most critical ones seem to be: b) If the file appears to reside on a file system that is not mounted (as can happen when the path contains a drive letter), the default mode is TEXT. Beginning with B20 it can be set to BINARY by adding "binmode" to the CYGWIN environment variable. c) On B19 pipes get opened in text mode. Beginning with B20 pipes are always opened in binary mode. and [no]binmode - use 'binmode' as the default open mode when the mode is not otherwise specified in the open or by mount. On B19 this does not affect pipes and path specs like //c/foo. On B20 it seems to at least change the mode for //c/foo-like paths to binary. (default: disabled) 5. Does binmode switch pipes to binary mode or are they binary by default now? Where does it take effect, at bash- or cygwin.dll-level? 6. Are the CYGWIN parameters ntea and mixed still patches by Sergey or in the official source tree? At least ntea seems to be official now but what about mixed? 7. Would there be interest from the public and, Goeffrey, your side to take some of the answers over into the official FAQ? I would greatly appreciate that since I don't want to start cluttering knowledge into little bitty pieces all over the net when there's a central point where it can and should be collected. Also it would shrink down my mini FAQ to a resource pointer again which it originally was intended to be. :) 8. Are there any new resources that should be added? There are some on my working list I can't visit now but want to include as soon as I've seen them: http://www.vtt.fi/tte/staff/tml/gimp/win32/ http://www-public.rz.uni-duesseldorf.de/~tolj http://www.io.com/~bub/rxvt.html http://www.feld.cvut.cz/~xtomasej/SemTel_en.html http://www.feld.cvut.cz/~xtomasej/semtel_en.html http://mujweb.cz/web/tomasek/semtel_cz.html http://sourceware.cygnus.com/cygwin/cygwin-ug-net/setup-net147.html 9. And of course: Is everything else stated in the FAQ correct, especially the defaults for all the CYGWIN options? :) And now to something completely different: gnuwin32 mini FAQ and resource pointer $Id: gnuwin32-mini-faq.txt,v 1.14 1998/12/01 02:15:20 michael Exp $ Contents: 0. Introduction 1. Cygwin 1.1. Cygwin most frequently asked questions 1.1.1. Binary mounts 1.1.2. Long pauses occuring randomly in bash 1.1.3. Windows 95 freezing up 1.1.4. Options for the CYGWIN environment variable 1.2. Cygwin resources 1.2.1. Web sites 1.2.2. FTP archives 2. Mingw32 2.1. Mingw32 resources 2.1.1. Web sites 2.1.2. FTP archives 3. FTP Upload 4. Acknowledgements 5. Legal stuff 0. Introduction This document tries to answer the gnuwin32 mailing list's most frequently asked questions. It is not intended to replace any other document you should have read before mailing a question to the list but tries to give a comprehensive list of such resources. It also tries to collect all related, interesting and up-to-date download locations. 1. Cygwin Before doing anything else you should make sure that you have updated your Cygwin package with the latest patches and enhancements, even and especially if you just downloaded and installed it: - Sergey Okhapkin's coolview package contains an updated Cygwin DLL that reflects the latest developments and fixes a lot of known problems. - Mumit Khan's compilation of egcs for Cygwin32 B19 fixes lots of problems with the tools that come with the environment, especially if you're using the C++ compiler. This is a drop-in replacement for the gcc toolset (which of course only makes sense on Cygwin32 B19). URL's are listed below. 1.1. Cygwin most frequently asked questions If your problem doesn't go away after the above mentioned updates, perhaps the following helps solving it: 1.1.1. Binary mounts Under Unix when an application reads from a file it gets exactly what's in the file on disk and the converse holds on writing. The situation is different in the DOS/Windows world where a file can be opened in one of two modes, BINARY and TEXT. In the BINARY mode the system behaves exactly as in Unix. However in TEXT mode there are major differences: a) On writing in TEXT mode, a NL (\n,^J) is transformed into the sequence CR (\r,^M) NL.. b) On reading in TEXT mode, a CR followed by an NL is deleted and a ^Z character signals the end of file. This can break havoc with seek/fseek since the number of bytes actually in the file may differ from that seen by the application. In the open() function call, BINARY mode can be specified with O_BINARY and TEXT mode with O_TEXT. BINARY mode can be specified in an fopen() call by adding a "b" to the mode string. TEXT mode is the default on normal DOS/Windows systems, but not necessarily in Cygwin. The mode of a file can be changed by the call setmode(fd,mode) where fd is a file descriptor (an integer) and mode is O_BINARY or O_TEXT. The function returns O_BINARY or O_TEXT depending on the mode before the call, and EOF on error. Most ascii files produced on a Unix system contain no CR and ^Z and they are read in TEXT mode as they are in BINARY mode. However most DOS/Windows ascii files contain CR. Many programs written for Unix do not specify the mode when opening a file. If the default mode is BINARY, they may have trouble dealing with the CR NL at the end of a line. If the default mode is TEXT, troubles occur with files containing binary data. The Cygwin system gives us some flexibility in deciding how files are to be opened when the mode is not specified explicitly: a) If the file appears to reside on a file system that is mounted (i.e. if its path name starts with a directory displayed by "mount") then the default is specified by the mount flags. b) If the file appears to reside on a file system that is not mounted (as can happen when the path contains a drive letter), the default mode is TEXT. Beginning with B20 it can be set to BINARY by adding "binmode" to the CYGWIN environment variable. c) On B19 pipes get opened in text mode. Beginning with B20 pipes are always opened in binary mode. d) When a program is launched by a Cygwin or DOS shell, its standard input, output and error are in TEXT mode, except if they are piped or redirected. When redirecting, the Cygwin shells uses rules (a-c). For rule b), the relevant value of CYGWIN is that at the time the shell was launched and not that at the time redirection occurs. The DOS shell always redirects with BINARY mode. Cygwin utilities dealing with binary files (such as "od", (object dump), which is useful to understand what is going on with CR NL) open files in BINARY mode. Others, such as "cat" and "cmp" use the default, which can cause problems if the default is TEXT but the file contains binary data. On the other hand using BINARY as the default also causes difficulties, for example when shells or "make" read files containing CR NL. The following script deletes CRs from files: #!/bin/sh # Remove \r from the files given as arguments for file in "$@" do CYGWIN=binmode sh -c "tr -d \\\"\\\r\\\" < '$file' > c:tmpfile.tmp" if [ "$?" = "0" ] then rm "$file" mv c:tmpfile.tmp "$file" fi done This works irrespective of the mount because rule b) applies for the path c:tmpfile.tmp. According to rule d) CYGWIN must be set before invoking the shell. Those precautions are necessary because "tr" does not setmode its standard output to BINARY. It would thus reintroduce \r when writing to a file on a TEXT mounted file system. The desired behavior can also be obtained by using "tr" in a .bat file. Of course you can also simply use the recode package compiled by Michael Hirmke if it's not a problem that they require binary mounts. 1.1.2. Long pauses occuring randomly in bash [ text goes here. any volunteers? ] 1.1.3. Windows 95 Freezing Up (and related problems) (It's unknown if and how this applies to Cygwin B20, too. Feedback is very welcome.) Symptoms to be treated Trying to stop a program (e.g. by ctrl-C) hangs up W95 Errors in typing in a command often hang up W95 bash.exe won't work in the role of /bin/sh.exe can't lstat or find files involving a specified drive Steps to take Install USB support Use better version of cygwinb19.dll Use disk data/directory/registry maintenance software replace /bin/sh.exe with a copy of bash.exe USB The "Universal Serial Bus" scheme not only supports a scheme of installation which is preferred for many devices, often including video and sound cards. It also includes a more workable scheme for trapping program faults. While USB support is integral to W98, it is an optional patch for W95 which is to be added to the standard installation. After installation, USB appears in the list of removable software under the Settings/Control Panel/Add/Remove Programs. It must be removed while performing OS repairs. OSR2 versions of Windows 95 include an optional usb patch on the CD, in \other\updates\usb. Instructions are in a README file there. This is a 2-step process involving yet another reboot. For earlier versions of W95, there are hot fix patches which may be found by checking the leads in the gnuwin32/Cygwin FAQ. cygwinb19.dll The B19.1 version of cygwinb19.dll is better than the original, and the Okhapkin version from http://www.lexa.ru is better yet. lexa.ru is quite difficult to connect properly here on the other side of the world; the best time probably is around 7 am Sunday morning in Russia. You can't install cygwinb19 while the older copy is running; just use a plain DOS window or My Computer to copy the new one over the old, after which you can open a bash window again. Disk data maintenance gnu-win32 increases the importance of standard measures to keep registry and directory structures clean, and disk data well organized. bash Many users of NT have recommended dispensing with the ash shell which is installed in the Cygwin /bin/sh.exe. This is not recommended under W95 until you have installed USB. Undo whatever you have done with /bin (blow it away). The following works after USB is installed: cd / mkdir bin cd bin cp $CYGFS/H-i386-cygwin32/bin/bash.exe sh.exe If you like, you can build bash-2.02 from source, or install Okhapkin's souped up version of it. 1.1.4. Options for the CYGWIN environment variable the following parameters to Cygwin's CYGWIN environment variable may be used to affect its behaviour. CAUTION! On B19 and before the CYGWIN variable was named CYGWIN32. With B20 the name changed to CYGWIN while working still the same. There has also been a bug in B20 on handling the CYGWIN parameters which made it neccessary to add two spaces before the first parameter like 'CYGWIN= tty binmode'. This has been fixed with Sergey Okhapkin's latest coolview. [no]title - display command line of currently running process in console title. (default: disabled) [no]strip_title - works in conjunction with 'title'. Strips the path spec from what is displayed in the console title bar when the program is run. (default: disabled) [no]tty - makes consoles more UN*X-like which improves compatibility with UN*X apps but may cause problems with non-Cygwin apps. (default: disabled) [no]binmode - use 'binmode' as the default open mode when the mode is not otherwise specified in the open or by mount. On B19 this does not affect pipes and path specs like //c/foo. On B20 it seems to at least change the mode for //c/foo-like paths to binary. (default: disabled) [no]glob - do perform globbing operations on the command line when a Cygwin process is being invoked from a non-Cygwin shell. (default: enabled) strace - a cygwinb19.dll debugging aid. Setting mask to '1' will cause reams of information about the operation of Cygwin to be written to 'file' as Cygwin operates. The rest of the bits control the display various Cygwin subsystems. For a complete list check out /usr/include/sys/strace.h. The cache setting controls how much strace output will be held in memory before being output to disk. (default: disabled) The following option is available with B20 or Sergey Okhapkin's coolview for B19 or B20 only: [no]ntea - use extended file attributes on Windows NT. (default: disabled) This option is provied by Sergey's coolviews only: [no]mixed - create case-sensitive filenames on ntfs partitions. (default: disabled) 1.2. Cygwin resources If the above doesn't answer your question you should read the Cygwin FAQ at http://www.cygnus.com/misc/gnu-win32/faq.html before posting any question to the list. Please also research your question via the Searchable Mail Archives at http://www.cygnus.com/ml/gnu-win32. Most problems have already been discussed and solved on the list. If you are searching for a port of a specific program or further information on a certain topic, you should check out the following Cygwin related sites: 1.2.1. Web sites http://sourceware.cygnus.com/cygwin/ (project page) http://www.cygnus.com/pubs/gnupro/ (comercial page) http://www.cygnus.com/misc/gnu-win32/faq.html (Cygwin faq) http://www.cygnus.com/ml/gnu-win32 (searchable mailing list archive) http://www.eGroups.com/list/gnu-win32/ (mailing list archive mirror) http://aquarius.franken.de/docs/develop/gnuwin32/GNUWin32.txt (Michael Hirmke - package porting notes) http://dao.gsfc.nasa.gov/software/grads/win32/X11R6.3/ (Arlindo da Silva - X11R6.3 binaries) http://gnu-win32.paranoia.ru (Chuck Bogorad - ports - sometimes down) http://www.alank.net/ (GNU-Win32 Bash Configuration) http://www.dol.ru/users/valtul (Valery Tulnikov - ports) http://www.freeyellow.com/members5/gw32/ (Earnie Boyd - resource pointer) http://www.geocities.com/SiliconValley/Garage/8516/gimp/gimpw32.html (Craig Setera - gimp) http://www.itribe.net/virtunix/ (more tools and man pages) http://www.kedemel.demon.co.uk/ (Darren - ports) http://www.lexa.ru/sos (Sergey Okhapkin - updates and ports) http://www.multione.capgemini.fr/tools/pack_ipc/ (Ludovic Lange - ipc package) http://www.parallax.co.uk/~andyp/index_text.html (Andy Piper - ports) http://www.tiac.net/users/cgf (Christopher Faylor - ports) http://www.xraylith.wisc.edu/~khan/software/gnu-win32/ (Mumit Khan - updates and ports) 1.2.2. FTP archives ftp://go.cygnus.com/pub/sourceware.cygnus.com/cygwin (Cygwin FTP site) ftp://dao.gsfc.nasa.gov/pub/uwm_coads/X11R6.3 (Arlindo da Silva - X11R6.3 binaries) ftp://ftp.cs.nyu.edu/pub/local/fox/cygwin32 ftp://pipeline.ucsd.edu/pub/dsf/cygwin32 (David Fox - RPM port and packages) ftp://ftp.franken.de/pub/win32/develop/gnuwin32/cygwin32/ (Michael Hirmke - German mirror and ports collection) ftp://www.lexa.ru/pub/domestic/sos/ (Sergey Okhapkin - fixes and ports) ftp://ftp.parallax.co.uk/pub/andyp (Andy Piper - fixes and ports) ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin32/ (Mumit Khan - egcs binaries) 2. Mingw32 2.1. Mingw32 resources 2.1.1. Web sites http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32/ (Jan Jaap van der Heijden - gcc binaries) http://www.freeyellow.com/members5/gw32/ (Earnie Boyd - resource pointer) http://www.fu.is.saga-u.ac.jp/~colin/gcc.html (Colin Peters - project page) http://www.xraylith.wisc.edu/~khan/software/gnu-win32/ (Mumit Khan - updates and ports) 2.1.2. FTP archives ftp://agnes.dida.physik.uni-essen.de/home/janjaap/mingw32 (Jan Jaap van der Heijden - gcc binaries) ftp://ftp.franken.de/pub/win32/develop/gnuwin32/mingw32/ (Michael Hirmke - German mirror and ports collection) ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/ (Mumit Khan - egcs binaries) 3. FTP Upload Thanks to Michael Hirmke it is possible to host your port at the German gnuwin32 mirror ftp.franken.de. If you upload a port, Michael will create a seperate directory for your package and also include it in his package report. The report gives the following instructions on uploading: *How to upload to German GNUWIN32 site* ------------------------------------- - how to upload to our German GNUWIN32 site: site: ftp.franken.de user: ftp/anonymous password: To get directly to the GNUWIN32 upload/incoming directory type "cd gnuwin32:" (note the colon following "gnuwin32") and then "cd incoming" Please always add a short readme on what you've uploaded. I'd like best, if the description would follow this format: ----------------------< snip snip snip >------------------------- ** -------------- - what is it? - - system - - preliminaries - - configure - - make - - make install - - notes - - package availability - on - in - as - contributed by - () ----------------------< snip snip snip >------------------------- There is no need to tell me, that you have uploaded something, because I'll get informed automatically. Please note: *I will delete anything, which does not look like a useful* *GNUWIN32 package !* *So please don't upload any warez, spam or similar garbage !* 4. Acknowledgements Special thanks go to Earnie Boyd who kindly gave me his signature to create an FAQ out of it and contributed many great ideas. Also I want to thank Christopher Faylor, Michael Hirmke, Pierre Humblet, Goeffrey Noer, Timothy Prince and Sergey Okhapkin, who allowed me to include their huge knowledge on Cygwin in this document. And of course I want to thank all the developers at Cygnus and all over the net for developing such a great environment. 5. Legal stuff I disclaim everything. :) Copyright (c) 1998 by Michael Weiser, all rights reserved. # end of file Thanks for reading this far! :-) -- bye, Michael - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".