From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Weiser To: gnu-win32@cygnus.com Subject: [FAQ] gnuwin32 mini FAQ and resource pointer Date: Sun, 31 Jan 1999 23:52:00 -0000 Message-id: <199901150211.DAA01196@khazad-dum.weiser.saale-net.de> X-SW-Source: 1999-01n/msg00417.html gnuwin32 mini FAQ and resource pointer $Id: gnuwin32-mini-faq.txt,v 1.15 1999/01/15 02:10:00 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. 0.1. News - support for B19 dropped since B20.1 seems to be stable now - some new pointers - some expired and dead ones removed - revised section 1.1.1. (Binary mounts) 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-1.1.1 for Cygwin fixes some 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. 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 The Issue ********* 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. The mode can be specified explicitly as explained in the Programming section below. In an ideal DOS/Windows world, all programs using lines as records (such as bash, make, sed ...) would open files (and change the mode of their standard input and output) as TEXT and all other programs (such as cat, cmp, tr ...) would use BINARY. In practice in the Cygwin world, only programs that deal explicitly with object files specify the mode as BINARY (this is the case of "od", which is helpful to diagnose CR problems). All others use the default. The default Cygwin behavior *************************** The Cygwin b20.1 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 pathname 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, except if the CYGWIN environment variable contains "binmode". c) 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 BINARY mode if CYGWIN contains "tty", else in TEXT mode, except if they are piped or redirected. When redirecting, the Cygwin f CYGWIN is that at the time the shell was launched and not that at the time the program is executed. The DOS shell always pipes and redirects with BINARY mode. What to do ********** If you work in a Dos/Windows world, setting the mounts and CYGWIN to TEXT mode makes sense. This will avoid seeing unexpected CRs in shell scripts and Makefiles . Unfortunately you will have other problems. Firstly, the Dos/Windows world is not ideal under Cygwin, e.g. "cat" will not work with binary files ( input will stop at ^Z, CR will be introduced in the output, etc... ). Secondly, you will introduce CR in files you write, which causes problems when moving them to Unix. If you move files back and forth to a Unix system or share a disk with one, use BINARY mode. Make sure to remove CRs from all Makefiles and shell scripts. Example ******* 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 -d \r" in a .bat file. Programming *********** In the open() function call, BINARY mode can be specified with O_BINARY and TEXT mode with O_TEXT. These symbols are defined in . In the fopen() function call, BINARY mode can be specified by adding a "b" to the mode string; there is no direct way to specify TEXT mode. 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. 1.1.2. Long pauses occuring randomly in bash Should be fixed as of B20 and greater. 1.1.3. Windows 95 Freezing Up (and related problems) (Is anyone's Windows 95/98 out there still freezing with B20.1? Please give me some feedback since I'll remove that paragraph otherwise.) 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. 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. There has 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 and B20.1. [no]title - [do not] display command line of currently running process in console title. (default: disabled) [no]strip_title - [do not] strip the path spec from what is displayed in the console title bar when the program is run. This works in conjunction with 'title'. (default: disabled) [no]tty - [do not] make consoles more UN*X-like to improve compatibility with UN*X apps. This may cause problems with non-Cygwin apps. (default: disabled) [no]binmode - [do not] use 'binmode' as the default open mode when the mode is not otherwise specified in the open or by mount. This espacially applies to path specs like //c//foo. (default: disabled) [no]glob - [do not] perform globbing operations on the command line when a Cygwin process is being invoked from a non-Cygwin shell. (default: enabled) [no]ntea - [do not] use extended file attributes on Windows NT. (default: disabled) strace - a cygwin1.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) This option is provied by Sergey's coolviews only: [no]mixed - [do not] create case-sensitive filenames on NTFS partitions. (default: disabled) Please check http://sourceware.cygnus.com/cygwin/cygwin-ug-net/setup-env.html for the latest happenings. 1.2. Cygwin resources If the above doesn't answer your question you should read the Cygwin FAQ at http://sourceware.cygnus.com/cygwin/faq_toc.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://sourceware.cygnus.com/cygwin/faq_toc.html (Cygwin FAQ) http://sourceware.cygnus.com/cygwin/cygwin-ug-net/cygwin-ug-net.html (Cygwin User's Guide) http://sourceware.cygnus.com/cygwin/cygwin-api/cygwin-api.html (Cygwin API Reference) http://www.cygnus.com/ml/gnu-win32 (searchable mailing list archive) http://www.eGroups.com/list/gnu-win32/ (mailing list archive mirror) http://www.cygnus.com/pubs/gnupro/ (comercial page) 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 for B19) http://www-public.rz.uni-duesseldorf.de/~tolj/ (Cygwin Porting Project - ports) http://www.alank.net/ (GNU-Win32 Bash Configuration) http://www.askesis.nl/AskesisPostgresIndex.html (Askesis - PostgreSQL) http://www.dol.ru/users/valtul/ (Valery Tulnikov - ports) http://www.freeyellow.com/members5/gw32/ (Earnie Boyd - resource pointer) http://www.i21.com/~tjump/files/ (Theodore Jump - Emacs functions) http://www.io.com/~bub/rxvt.html (rxvt that doesn't need an X server) 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.xemacs.freeserve.co.uk/ (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 - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request@cygnus.com" with one line of text: "help".