Re: Bad mirros
Siegfried Heintze wrote: I've been trying for weeks to upgrade my Cygwin installation but the setup program, after I have spent 15 or 20 minutes selecting the software I want, comes back and says the download is aborted, would I like to try again? Maybe it has been already fixed in setup, but if not, then you may be running into this: http://sources.redhat.com/ml/cygwin/2004-06/msg01103.html -- Jacek. -- 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/
find prints wrong file size for files 2GB
Win2kSP4+patches, cygwin1.dll 1.5.11, findutils 4.1.7-4 Test case below. $ cat truncate.c EOF #include unistd.h #include stdio.h #include stdlib.h #include errno.h int main(int argc, char **argv) { off_t size; char *endptr = argv[2]; if (argc != 3) { fprintf(stderr, usage: truncate path size\n); exit(1); } errno = 0; size = strtoull(argv[2], endptr, 10); if (!endptr || endptr == argv[2] || *endptr || size 0 || (size == 0 errno)) { fprintf(stderr, truncate: invalid size\n); exit(1); } printf(truncating %s to %lld bytes\n, argv[1], size); if (truncate(argv[1], size)) { int saveerr = errno; perror(truncate); fprintf(stderr, errno was %d\n, saveerr); exit(1); } exit(0); } EOF $ g++ truncate.c -o truncate.exe $ touch aaa $ ./truncate.exe aaa 20 truncating aaa to 20 bytes $ ls -l aaa -rw-r--r--1 sc0rpNone 20 Dec 6 10:54 aaa $ find ./aaa -printf %10s %p\n 20 ./aaa $ ./truncate.exe aaa 30 truncating aaa to 30 bytes $ ls -l aaa -rw-r--r--1 sc0rpNone 30 Dec 6 10:54 aaa $ find ./aaa -printf %10s %p\n 18446744072414584320 ./aaa $ ./truncate.exe aaa 47 truncating aaa to 47 bytes $ ls -l aaa -rw-r--r--1 sc0rpNone 47 Dec 6 10:54 aaa $ find ./aaa -printf %10s %p\n 405032704 ./aaa -- Jacek. -- 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/
Re: make doesn't work!
I have been searching the answer for my problem for some while but didn't get anything useful. Searching on google for: windows32_openpipe unable to launch process, leads to information about old bug in make: http://64.233.183.104/search?q=cache:z5XWgxdFFBAJ:www.geocrawler.com/mail/msg_raw.php3%3Fmsg_id%3D3200125+windows32_openpipe+unable+to+launch+processhl=en I have been using make for some while under cygwin and it just work fine. However this week I tried to run make again, I got: process_begin: CreateProcess((null), /bin/uname, ...) failed. y:\BIN\make.exe: *** windows32_openpipe (): unable to launch process (e=3) . Stop. I uninstalled cygwin and reinstalled it, but the problem is still there. Do you guys have a clue about what it should be? Read and follow: http://cygwin.com/problems.html WAG: y:\BIN\make.exe is probably not cygwin version of make. Remove y:\BIN from PATH. -- Jacek. -- 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/
Re: Cron malfunction after date change
Xavier Nodet wrote: On Thu, 04 Nov 2004 15:37:12 +0100 Jacek Trzmiel wrote: cygwin1.dll 1.5.11-1, win2ksp4+patches Cron is a separate package, that was updated on 20th, October, to correct a problem where cron would endlessly sleep after a time/date change. Do you have the latest version? Yes. $ cygcheck -srv | grep cron cron3.0.1-13 $ ll /usr/sbin/ | grep cron -rwxrwxrwx1 sc0rpUsers 25088 Oct 20 14:07 cron.exe -- Jacek. -- 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/
Cron malfunction after date change
cygwin1.dll 1.5.11-1, win2ksp4+patches Steps to reproduce: 1. Start cron: cygrunsrv --stop cron cygrunsrv --remove cron cygrunsrv --install cron -p /usr/sbin/cron -a -D -i cygrunsrv --start cron 2. Add task to cron to start at specified time (about 3 minutes from now) every day. I.e. something like this: 34 15 * * * /some/app 3. Change date to previous day. 4. Wait over a minute. 5. Change date to current day. 6. Wait till time set in step 2. BUG: Added task doesn't get executed. EXPECTED: Task started at correct time. I've also seen something like this: - I've added task to execute 22:30 every day. - About 15:00 changed date to previous day, and few minutes later to current day. - Task has not been started at 22:30. - Task has been stated some time after 15:00 next day. -- Jacek. -- 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/
Setup.exe: Can't download sources for older (not latest) version of port
setup.exe 2.427, win2ksp4+patches Steps to reproduce: 1. Start setup.exe 2. Click Next 3. Select Download from Internet 4. Click Next 5. Browse for download directory 6. Click Next 7. Select Direct Connection 8. Click Next 9. Select ftp://ftp-stud.fht.esslingen.de; 10. Click Next 11. In Devel category select older (not latest) version of Subversion port (e.g. select 1.0.6-1 when latest is 1.1.1-1). 12. Click on 'Src' checkmark for Subversion port. 13. Click Next 14. Wait for download to complete. BUG: Files in download directory (release\subversion\): subversion-1.0.6-1.tar.bz2 subversion-1.1.1-1-src.tar.bz2 EXPECTED: Files in download directory (release\subversion\): subversion-1.0.6-1.tar.bz2 subversion-1.0.6-1-src.tar.bz2 Excerpt from setup.ini: @ subversion sdesc: A version control system ldesc: Subversion is a version control system that aims to be a compelling replacement for CVS in the open source community category: Devel requires: cygwin libaprutil0 libapr0 libdb4.2 libneon24 expat version: 1.1.1-1 install: release/subversion/subversion-1.1.1-1.tar.bz2 993236 a00c29db203a4f317f79523b711dbabc source: release/subversion/subversion-1.1.1-1-src.tar.bz2 6806426 8f4b616b7d5a63f6b25b5b528fd80795 [prev] version: 1.0.6-1 install: release/subversion/subversion-1.0.6-1.tar.bz2 338841 64a182d75742886b04cee39518a6dff7 source: release/subversion/subversion-1.0.6-1-src.tar.bz2 6058371 8a21333c388df9dd06e89434f42b1cf9 setup.log.full attached. Best regards, Jacek. setup.log.full.bz2 Description: Binary data -- 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/
Subversion: Bad handling of svn:eol-style native on textmode mounts
svn checkout of file with svn:eol-style set to native does create: a) on binary mount - file with unix endlines, b) on text mode mount - also file with unix endlines. I assume that correct behaviour in second case should be to create file with windows endlines. Is my assumption correct, and there is a bug in subversion port? Steps to reproduce below. svn 1.0.6, cygwin1.dll 1.5.11-1, win2ksp4+patches ### ### create test repository ### /cygdrive/d/ - binary mount $ mkdir -p /cygdrive/d/svn $ svnadmin create /cygdrive/d/svn/repo $ mkdir -p /cygdrive/d/test $ cd /cygdrive/d/test $ svn co file:///cygdrive/d/svn/repo . Checked out revision 0. $ echo test file $ dump file file: Addr 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 2 4 6 8 A C E 7465 7374 0atest. $ svn add file A file $ svn propset svn:eol-style native file property 'svn:eol-style' set on 'file' $ svn ci -m Added file. Adding file Transmitting file data . Committed revision 1. ### /work/test2 - text mount $ mkdir -p /work/test2 $ cd /work/test2 $ svn co file:///cygdrive/d/svn/repo . A file Checked out revision 1. $ dump file file: Addr 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 2 4 6 8 A C E 7465 7374 0atest. Best regards, Jacek. -- 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/
Re: SYSTEM-owned shell shortcut (Was Re: xinetd Permissions; IMAP server)
I've attached my sysbash, which WFM. Who knows there might be problems with it too ;-P It does display wrong number of seconds to start. Patch attached :) Besides there is small chance, that if run e.g. at 14:07:59 it will not manage to execute at command before 14:08:00, thus sheduling job for next day. Best regards, Jacek.--- sysbash.org2004-08-28 13:56:18.171875000 +0200 +++ sysbash2004-08-28 13:57:21.015625000 +0200 @@ -53,6 +53,7 @@ # Display result #--- at +s=`date +%S` echo -e \e[31mat id-number /delete \e[0m# - this will remove a badly set job\n \ -\e[41m The new SYSTEM owned shell will launch in $(( 60 - $m )) seconds, at $h:$m \e[0m +\e[41m The new SYSTEM owned shell will launch in $(( 60 - $s )) seconds, at $h:$m \e[0m -- 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/
Re: Compilation errors not shown properly in Cygwin
Larry Hall wrote: Sounds like a tty thing to me. Try adding to your CYGWIN environment variable 'notty' and starting a new cygwin.bat. I've added CYGWIN environment variable: System Properties/Advanced/Environment Variables/System variables/New... Variable Name: CYGWIN Variable Value: notty Started new cygwin shell: [EMAIL PROTECTED] ~ $ echo $CYGWIN notty [EMAIL PROTECTED] ~ $ cd /work/SourcesStorage2/MakeTest/ [EMAIL PROTECTED] /work/SourcesStorage2/MakeTest $ make all msdev MakeTest.dsp /MAKE MakeTest - Win32 Debug make: *** [all] Error 1 Looks that it doesn't help. Regards, Jacek. -- 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/
Re: Compilation errors not shown properly in Cygwin
Rajagopalan, Karthik wrote: [...] I am trying to compile a C program through Makefile from Cygwin. This C program has syntax errors which are supposed to be shown by Cygwin when running C compiler. It just indicates the following lines and stops : make: *** [/cygdrive/h/test.obj] Error 1 If I run the C program without using Makefile from Cygwin, errors are properly indicated. [...] If you does invoke VC compile in Makefile like this: msdev MakeTest.dsp /MAKE MakeTest - Win32 Debug then use this workarounds: msdev.com MakeTest.dsp /MAKE MakeTest - Win32 Debug or that one: bash -c '{ msdev MakeTest.dsp /MAKE MakeTest - Win32 Debug | cat; [ $${PIPESTATUS[0]} = 0 ]; }' This is probably issue somehow related to: http://groups.yahoo.com/group/vimdev/message/33770 In case any Cygwin developer care to debug this problem, I've prepared minimal test case. Attached MakeTest.tgz contains VC++ 6.0 project and Makefile: MakeTest/Makefile MakeTest/MakeTest.cpp MakeTest/MakeTest.dsp MakeTest/MakeTest.dsw There is intentional syntax error in MakeTest.cpp file. Makefile does have two targets: all: msdev MakeTest.dsp /MAKE MakeTest - Win32 Debug betterall: bash -c '{ msdev MakeTest.dsp /MAKE MakeTest - Win32 Debug | cat; [ $${PIPESTATUS[0]} = 0 ]; }' Steps to reproduce: - Unpack attached tgz - Make sure that directory with 'msdev.exe' from Visual C++ 6.0 is in your PATH (usually c:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\) - start bash in normal windows console (NOT rxvt) - cd to MakeTest directory - type 'make all' Output will NOT contain messages from msdev: $ make all msdev MakeTest.dsp /MAKE MakeTest - Win32 Debug make: *** [all] Error 1 - type 'make betterall' Output WILL contain messages from msdev: $ make betterall bash -c '{ msdev MakeTest.dsp /MAKE MakeTest - Win32 Debug | cat; [ ${PIPESTATUS[0]} = 0 ]; }' Configuration: MakeTest - Win32 Debug Compiling... MakeTest.cpp d:\Sources\MakeTest\MakeTest.cpp(6) : error C2059: syntax error : '}' d:\Sources\MakeTest\MakeTest.cpp(6) : warning C4508: 'main' : function should return a value; 'void' return type assumed Error executing cl.exe. MakeTest.exe - 1 error(s), 1 warning(s) I've encountered this problem long long time ago, so it's not some recent regression. Both invocations of msdev from Makefile display messages correctly under rxvt console. Win2kSP4, all updates, cygwin1.dll snapshot 20040720, make 3.80-1, Visual C++ 6.0. Regards, Jacek. BTW: Shouldn't Cygwin and/or bash give preference to *.com over *.exe as windows' cmd does? Currently if you have t.exe and t.com in some directory in your path and you'll type 't' in shell then cygwin will start t.exe, and windows' cmd will start t.com. MakeTest.tgz Description: application/compressed -- 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/
Cannot send *.zip attachement to cygwin mailing list
I've tried to send mail with *.zip attachement to cygwin mailing list, but got this error: Subject: failure notice Hi. This is the qmail-send program at home.pl. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out. cygwin at cygwin dot com: 12.107.209.250 failed after I sent the message. Remote host said: 552 we don't accept email with executable content (#5.3.4) Bug or a feature? *.tgz attachement with identical contents passed through: http://cygwin.com/ml/cygwin/2004-08/msg00795.html Regards, Jacek. -- 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/
Re: Mounted text mode but acting binary
So, grep appears to be acting as if the current directory is binary mode, but the mount table shows it as text mode. What am I missing? e:\mas\mmb\sql\ap on /e/mas/mmb/sql/ap type system (textmode) e: on /e type user (binmode,noumount) I'm in the e:\mas\mmb\sql\ap directory when I'm doing the grep. Probably this bug: http://cygwin.com/ml/cygwin/2004-06/msg00137.html Fixed here: http://cygwin.com/ml/cygwin-patches/2004-q2/msg00178.html Recheck with latest snapshot. Regards, Jacek. -- 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/
Re: Mounted text mode but acting binary
Jacek's message hit the nail on the head. I downloaded the most recent snapshot, and it works. So it was a Cygwin bug (although Pierre's message seems to indicate it didn't manifest itself in 1.5.9, that's where I saw it originally; I only dl'd 1.5.10 to eliminate 1.5.9 as the problem). This bug was present for quite long time: http://cygwin.com/ml/cygwin/2004-06/msg00159.html Regards, Jacek. -- 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/
Re: STL std::random_shuffle behavior fails with lrand48 (workaround)
If someone else could demonstrate that the bug exists on other platforms, I would be grateful. I've compiled and run code from: http://cygwin.com/ml/cygwin/2004-07/msg01118.html on Cygwin and FreeBSD machine: cygwin1.dll snapshot 20040720-12:03:09: $ g++ --version g++ (GCC) 3.3.1 (cygming special) Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++ -o lr lr.cpp $ ./lr changes before: 0 1 2 3 4 5 6 changes after: 6 0 1 2 3 4 5 changes after: 5 6 0 1 2 3 4 changes after: 4 5 6 0 1 2 3 FreeBSD 5.2: $ g++ --version g++ (GCC) 3.3.3 [FreeBSD] 20031106 Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++ -o lr lr.cpp $ ./lr changes before: 0 1 2 3 4 5 6 changes after: 1 5 6 4 3 2 0 changes after: 5 3 0 4 2 1 6 changes after: 1 6 4 5 0 3 2 Regards, Jacek. -- 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/
svn diff fails in textmode dir
Subversion does have problem with doing diff inside working copy checked out on textmode mounted path. Win2kSP4 + all updates cygwin1-20040720 snapshot subversion-1.0.5-1 $ mount | grep work d: on /work type system (textmode) $ svnadmin create /svn $ mkdir -p /work/tmp/testdir $ cd /work/tmp/ $ echo test testdir/testfile $ svn import -m Test import. testdir file:///svn/testdir Adding testdir/testfile Committed revision 1. $ mv testdir testdir.old $ svn co file:///svn/testdir testdir A testdir/testfile Checked out revision 1. $ cd testdir $ echo test2 testfile $ svn diff svn: Failed to read file '.svn/text-base/testfile.svn-base': End of file found Best regards, Jacek. -- 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/
Re: ssh become slower and slower?
Xuefer wrote: winxp P3 866 after reboot, ssh seems as fast as telnet(almost same as local, no network issue) but after long time using ssh, it become slower and slower, taking more and more cpu time i hold down space key, the system process shown in taskmgr.exe is 98% released the key, the process restore to 0% any idea? Do you have any anti-virus monitor or firewall software on this machine? If so, uninstall it (disabling may not by sufficient) and retest. I've seen similar problem with Norton Internet Security on win2k. Greetings, Jacek. -- 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/
Re: sys.executable broken under 2.3.4
John P. Rouillard wrote: When running python -c import sys; print sys.executable it prints the current working directory rather than the path to python unless I invoke python with the full path. I can't reproduce this on a win 98 box, but on a windows 2k sp4 things are broken. Can anybody reproduce this? Works for me: $ pwd /home/sc0rp $ python -c import sys; print sys.executable /usr/bin/python $ python -V Python 2.3.3 $ uname -a CYGWIN_NT-5.0 sc0rp 1.5.10s(0.116/4/2) 20040530 22:57:25 i686 unknown unknown Cygwin Win2kSP4 + updates. Greetings, Jacek. -- 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/
Re: cvs checkout fails in directory that can be accessed via both textmode and binmode mounts
Hi Pierre, You have exposed an old bug in Cygwin. [...] I am wondering why the bug is not exposed in 1.5.9 Care to strace it? Well, the same thing happens in: cygwin 1.5.9 / cvs 1.11.6-3 cygwin 1.5.5 / cvs 1.11.6-3 I guess that I either checked out this directory somewhere else and moved it later or checked out in bin mode and converted endlines by hand or used even older version of cygwin/cvs (I don't remember, it was year ago). cvs co did work differently in 1.5.10 because this bug was masked by other one. It has been reexposed in 20040530 snapshot. Best regards, Jacek. -- 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/
Re: cvs checkout fails in directory that can be accessed via both textmode and binmode mounts
Jacek Trzmiel wrote: $ mkdir /testmnt/cygwin/test $ cd /testmnt/cygwin/test $ cvs -d /testmnt/cvsrep co prj : No such file or directoryirectory /testmnt/cvsrep/prj cvs checkout: skipping directory prj Some additional info: cygwin 1.5.10-3: $ cvs -d /testmnt/cvsrep co prj Checkout does work, but all files are created with unix endlines (on textmode mount). 20040530 snapshot: $ cvs -d /testmnt/cvsrep co prj Error message displayed (there is lone CR at the end of path): cvs checkout: cannot open directory /testmnt/cvsrep/prjCR: No such file or directory cvs checkout: skipping directory prj Some files are created in /testmnt/cygwin/test/CVS, and they have windows endlines. 20040530 snapshot: Same command run as above, but preceded by strace: $ strace cvs -d /testmnt/cvsrep co prj Checkout does work like in 1.5.10-3 version (no errors displayed, unix endlines in all files). Heisenbug? Regards, Jacek. -- 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/
cvs checkout fails in directory that can be accessed via both textmode and binmode mounts
Win2kSP4, cygwin1-20040530.dll snapshot, cvs 1.11.6-3 $ mount -ft c:\\ /testmnt $ mount C:\cygwin on / type system (binmode) c: on /sys type system (textmode) c: on /testmnt type system (textmode) snip $ mkdir /testmnt/cvsrep $ cvs -d /testmnt/cvsrep init $ mkdir prj $ cd prj $ echo test test $ cvs -d /testmnt/cvsrep import -m Test. prj sc start N prj/test No conflicts created by this import $ mkdir /testmnt/test $ cd /testmnt/test $ cvs -d /testmnt/cvsrep co prj U prj/test $ mkdir /testmnt/cygwin/test $ cd /testmnt/cygwin/test $ cvs -d /testmnt/cvsrep co prj : No such file or directoryirectory /testmnt/cvsrep/prj cvs checkout: skipping directory prj Strange, it did work for me one reboot earlier... Can someone reproduce it? Regards, Jacek. -- 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/
Re: No endline conversion while in dir that can be reached via both textmode and binmode mounts
Bug or a feature? Shouldn't /test/cygwin/t/d be 3 bytes long as well? I recall it working properly (i.e. converting to windows endlines) when inside such directory some time ago. Thanks for the report. It should be fixed in the May 28 snapshot. http://www.cygwin.com/snapshots/cygwin1-20040528.dll.bz2 Thanks, it does work. Greetings, Jacek. -- 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/
No endline conversion while in dir that can be reached via both textmode and binmode mounts
Win2kSP4, cygwin1-20040527.dll snapshot $ mount -ft c:\\ /test $ mount C:\cygwin\usr\X11R6\lib\X11\fonts on /usr/X11R6/lib/X11/fonts type system (binmode) C:\cygwin\bin on /usr/bin type system (binmode) C:\cygwin\lib on /usr/lib type system (binmode) C:\cygwin on / type system (binmode) c: on /sys type system (textmode) c: on /test type system (textmode) d: on /work type system (textmode) e: on /storage type system (textmode) f: on /cygdrive/f type user (binmode,noumount) g: on /cygdrive/g type user (binmode,noumount) p: on /cygdrive/p type user (binmode,noumount) $ mkdir /test/t $ mkdir /test/cygwin/t $ echo a /test/t/a $ echo b /test/cygwin/t/b $ cd /test/t $ echo c c $ cd /test/cygwin/t $ echo d d $ wc -c /test/t/* /test/cygwin/t/* 3 /test/t/a 3 /test/t/c 3 /test/cygwin/t/b 2 /test/cygwin/t/d 11 total Bug or a feature? Shouldn't /test/cygwin/t/d be 3 bytes long as well? I recall it working properly (i.e. converting to windows endlines) when inside such directory some time ago. Best regards, Jacek. -- 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/
How to launch gui app from cron
Hi all, Win2kSP4, cygwin1-20040527.dll snapshot I've added something like this via crontab -e: 0 11 * * * C:/WINNT/system32/dllcache/iexplore.exe That does start iexplore.exe (I can find process in Task Manager), however it does not show its window on desktop. How can I start win app from cron, so that gui is visible? Best regards, Jacek. -- 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/
Re: How to launch gui app from cron
Tomasz Rojek wrote: How can I start win app from cron, so that gui is visible? I would register cron as a service with option -i, or --interactive (Allow service to interact with the desktop). HTH Thanks, it does work. Gui app launched from cron does show on desktop after: $ cygrunsrv --stop cron $ cygrunsrv --remove cron $ cygrunsrv --install cron -p /usr/sbin/cron -a -D -i $ cygrunsrv --start cron Greetings, Jacek. -- 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/
Re: [Patch] Fix gethwnd race
On Thu, May 06, 2004 at 07:18:39PM -0500, Brian Ford wrote: Although not the complete rewrite you may have been hoping for, the attached patch does appear to fix the: Winmain: Cannot register window class, Win32 error 1410 portion of this bug: http://www.cygwin.com/ml/cygwin/2004-05/msg00232.html Christopher Faylor wrote: Thanks, but, I see that you're using busy loops. I use those in places where I have no choice but to do so or when the potential for a race is unlikely. I don't think that this is really a situation that qualifies for either. It seems like a muto is a cleaner choice here. I can change it to use critical section. I just have one question - where would be good place to put InitializeCriticalSection call? Best regards, Jacek.
Re: [Patch] Fix gethwnd race
(Redirected from cygwin-patches) http://cygwin.com/ml/cygwin-patches/2004-q2/msg00082.html On Thu, May 06, 2004 at 07:18:39PM -0500, Brian Ford wrote: Although not the complete rewrite you may have been hoping for, the attached patch does appear to fix the: Winmain: Cannot register window class, Win32 error 1410 portion of this bug: http://www.cygwin.com/ml/cygwin/2004-05/msg00232.html Christopher Faylor wrote: Thanks, but, I see that you're using busy loops. I use those in places where I have no choice but to do so or when the potential for a race is unlikely. I don't think that this is really a situation that qualifies for either. It seems like a muto is a cleaner choice here. On Fri, May 07, 2004 at 04:51:42PM +0200, Jacek Trzmiel wrote: I can change it to use critical section. I just have one question - where would be good place to put InitializeCriticalSection call? Christopher Faylor wrote: Please read what I said: It seems like a muto is a cleaner choice here. muto != critical section. I've realized what you have meant by writing 'muto' just after sending mail - found it in sync.h. I'm sure Brian can make the appropriate changes. Let's give him the opportunity to do so. I'm sure he can. However I don't see anything wrong with with trying to patch it myself. Even if my patch won't be accepted, I can learn something new by writing it. Just need a little helping hand from someone familiar with cygwin sources: where will be good place to put new_muto() call? BTW. Which list is more appropriate for such questions cygwin or cygwin-patches? Best regards, Jacek. -- 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/
Re: gethostname is thread-safe?
THE ERROR IS: ERROR gethostbyname() failed, h_errno=-1 Description: (null) ERROR socket() failed, Errno= 1 Description: Operation not permitted http://cygwin.com/ml/cygwin/2004-05/msg00191.html Best regards, Jacek. -- 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/
Re: pthreads and sockets - Cannot register window class error
Hi Brian, void test() { /* go find out about the desired host machine */ struct hostent *he = gethostbyname(HOST); if (he == 0) { perror(gethostbyname); exit(1); } Just a wild guess, but gethostbyname() is probably not reentrant and can't be called from threads like that. Thanks, it may be: http://www.opengroup.org/onlinepubs/009695399/functions/gethostbyaddr.html The gethostbyname() function need not be reentrant. A function that is not required to be reentrant is not required to be thread-safe. This can explain those errors: gethostbynamegethostbyname: Operation not permitted However Winmain: Cannot register window class, Win32 error 1410 still happens with modified code: --- ThreadingTest.cpp - #include iostream #include pthread.h #include stdlib.h #include stdio.h #include unistd.h #include sys/types.h #include sys/socket.h #include netinet/in.h #include netdb.h #include string.h #include assert.h using std::cout; using std::endl; const char *HOST= example.org; const int PORT= 80; const char *MESSAGE = GET / HTTP/1.0\r\n\r\n; struct hostent *g_he = 0; void sendall( int sd, const char *data, int datalen ) { assert( data ); assert( datalen = 0 ); while(datalen0) { int sent = send(sd, data, datalen, 0); if( sent == -1) { perror(send); exit(1); } data += sent; datalen -= sent; assert( datalen=0 ); } } void recvandprintall( int sd ) { const int bufferlen = 65536; char buffer[bufferlen]; while(true) { int got = recv(sd, buffer, bufferlen, 0); if(got == -1) { perror(recv); exit(1); } if(got==0) { cout got\n; cout.flush(); break; } } } void test() { /* fill in the socket structure with host information */ struct sockaddr_in pin; memset( pin, 0, sizeof(pin) ); pin.sin_family = AF_INET; pin.sin_addr.s_addr = ((struct in_addr *)(g_he-h_addr))-s_addr; pin.sin_port = htons(PORT); /* grab an Internet domain socket */ int sd; if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { perror(socket); exit(1); } /* connect to PORT on HOST */ if (connect(sd,(struct sockaddr *) pin, sizeof(pin)) == -1) { perror(connect); exit(1); } /* send a message to the server PORT on machine HOST */ sendall( sd, MESSAGE, strlen(MESSAGE) ); /* shutdown writing part of socket */ shutdown( sd, SHUT_WR ); /* wait for data to come back from the server and print it */ recvandprintall( sd ); close(sd); } void *task(void *arg) { test(); return NULL; } int main() { /* go find out about the desired host machine */ g_he = gethostbyname(HOST); if(g_he == 0) { perror(gethostbyname); exit(1); } assert( g_he-h_addrtype == AF_INET ); assert( g_he-h_addr_list[0] ); const int threads = 70; pthread_t threadTable[threads]; for(int i=0; ithreads; ++i) { if(pthread_create(threadTable[i], NULL, task, (void *)(i+1)) != 0) { cout pthread_create() error endl; abort(); } } for(int i=0; ithreads; ++i) { pthread_join( threadTable[i], NULL ); } return 0; } --- ThreadingTest.cpp - Best regards, Jacek. -- 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/
Re: pthreads and sockets - Cannot register window class error
Hi Reini, But we already found out that the culprit was Norton Firewall, closing your socket, wasn't it? NIS is gone. Best regards, Jacek. -- 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/
Re: pthreads and sockets - Cannot register window class error
Hi, I can't replicate your problem, but I know where it is coming from, basically standard windows winsock is not geared up to handle that man socket connections. When a socket is made and then closed the socket actually stays open for about 240-300 seconds depending on your registry settings, this is so that winsock can make sure the connection has been properly closed off. As Dave wrote - normal TCP behaviour. what you are seeing is that basically as you run your program more and more times, you are creating sockets in memory, every time the socket is closed YOU think that the socket is cleaned up but its not, and so you basically loose a bit of memory until the timeout for the socket has occurred, i guess through debugging where you run and re-run your test app you have run out of RAM so you see these errors. - Program failed with second run after reboot - netstat showed 140 sockets in TIME_WAIT state. - Program did run succesfully some tries later when netstat showed 484 sockets in TIME_WAIT state. The only thing you can do is not make so many client socket connections Same error did happen with 20 connections. I would not describe it as many. or use windows server which has a winsock geared for server like behavior, or make the modifications mentioned in the article, or just simply use *bsd or linux tcp/ip stack. Sure I can use other stack. But I prefer to find out exactly where and why error happens, so I can avoid it in the future. Best regards, Jacek. -- 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/
Re: pthreads and sockets - Cannot register window class error
void test() { /* go find out about the desired host machine */ struct hostent *he = gethostbyname(HOST); if (he == 0) { perror(gethostbyname); exit(1); } Just a wild guess, but gethostbyname() is probably not reentrant and can't be called from threads like that. Christopher Faylor wrote: Unless HOST is a numeric IP address, gethostbyname should be properly reentrant. The only time gethostbyname is not thread safe is when it is resolving a numeric IP. --- GetHostByNameTest.cpp -- #include iostream #include pthread.h #include stdlib.h #include stdio.h #include sys/socket.h #include netdb.h #include assert.h using std::cout; using std::endl; const char *HOST= example.org; void test() { for(int i=0; i100; ++i) { /* go find out about the desired host machine */ struct hostent *he = gethostbyname(HOST); if(he == 0) { perror(gethostbyname); exit(1); } assert( he-h_addrtype == AF_INET ); assert( he-h_addr_list[0] ); } } void *task(void *arg) { test(); return NULL; } int main() { const int threads = 70; pthread_t threadTable[threads]; for(int i=0; ithreads; ++i) { if(pthread_create(threadTable[i], NULL, task, (void *)(i+1)) != 0) { cout pthread_create() error endl; abort(); } } for(int i=0; ithreads; ++i) { pthread_join( threadTable[i], NULL ); } return 0; } --- GetHostByNameTest.cpp -- $ g++ GetHostByNameTest.cpp -lpthread -o GetHostByNameTest.exe ./GetHostByNameTest.exe $ g++ GetHostByNameTest.cpp -lpthread -o GetHostByNameTest.exe ./GetHostByNameTest.exe $ g++ GetHostByNameTest.cpp -lpthread -o GetHostByNameTest.exe ./GetHostByNameTest.exe $ g++ GetHostByNameTest.cpp -lpthread -o GetHostByNameTest.exe ./GetHostByNameTest.exe $ g++ GetHostByNameTest.cpp -lpthread -o GetHostByNameTest.exe ./GetHostByNameTest.exe $ g++ GetHostByNameTest.cpp -lpthread -o GetHostByNameTest.exe ./GetHostByNameTest.exe gethostbyname: Operation not permitted gethostbynamegethostbynamegethostbynamegethostbynamegethostbyname: : : : : Operation not permittedOperation not permittedOperation not permittedOperation not permittedOperation not permitted Win2k SP4 + hotfixes. Can someone reproduce it? Best regards, Jacek. -- 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/
Re: pthreads and sockets - Cannot register window class error
Hi Brian, $ g++ GetHostByNameTest.cpp -lpthread -o GetHostByNameTest.exe ./GetHostByNameTest.exe gethostbyname: Operation not permitted Win2k SP4 + hotfixes. Can someone reproduce it? Sure looks alot like this: http://www.cygwin.com/ml/cygwin/2004-04/msg00545.html have you tried a snapshot? Thanks, it works with latest snapshot. Should have checked this before... Nevertheless ThreadingTest.cpp posted here: http://cygwin.com/ml/cygwin/2004-05/msg00178.html still sometimes fails, even with 20040504 snapshot: $ g++ ThreadingTest.cpp -lpthread -o ThreadingTest.exe ./ThreadingTest.exe 238 [win] ThreadingTest 1696 Winmain: Cannot register window class, Win32 error 1410 896 [win] ThreadingTest 1696 Winmain: Cannot register window class, Win32 error 1410 $ g++ ThreadingTest.cpp -lpthread -o ThreadingTest.exe ./ThreadingTest.exe 10 [win] ThreadingTest 732 Winmain: Cannot register window class, Win32 error 1410 8362 [win] ThreadingTest 732 Winmain: Cannot register window class, Win32 error 1410 D:\Sources\Test\ThreadingTest.exe (1360): *** WFSO failed, Win32 error 6 11725 [win] ThreadingTest 732 Winmain: Cannot register window class, Win32 error 1410 Best regards, Jacek. -- 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/
Re: shutdown( socket, SHUT_WR ) - unexpected behaviour
Hi Dave, Just kind of wondering if the apache is prematurely dropping the line when it sees the FIN. No it doesn't. Here is dump when connecting to example.org: 01:14:34.237976 win2k.3042 example.org.80: S 3273603871:3273603871(0) win 16384 mss 1460,nop,nop,sackOK (DF) 01:14:34.423719 example.org.80 win2k.3042: S 3414317864:3414317864(0) ack 3273603872 win 5840 mss 1460,nop,nop,sackOK (DF) 01:14:34.423843 win2k.3042 example.org.80: . ack 1 win 17520 (DF) 01:14:34.423935 win2k.3042 example.org.80: P 1:19(18) ack 1 win 17520 (DF) 01:14:34.424017 win2k.3042 example.org.80: F 19:19(0) ack 1 win 17520 (DF) 01:14:34.612657 example.org.80 win2k.3042: . ack 19 win 5840 (DF) 01:14:34.613410 example.org.80 win2k.3042: F 703:703(0) ack 19 win 5840 (DF) 01:14:34.613539 win2k.3042 example.org.80: . ack 1 win 17520 nop,nop,sack sack 1 {703:704} (DF) 01:14:34.616794 example.org.80 win2k.3042: P 1:703(702) ack 19 win 5840 (DF) 01:14:34.617027 win2k.3042 example.org.80: R 3273603891:3273603891(0) win 0 (DF) 01:14:34.617331 example.org.80 win2k.3042: . ack 20 win 5840 (DF) 01:14:34.617435 win2k.3042 example.org.80: R 3273603891:3273603891(0) win 0 Hmm, FIN is sent before actual data, but this should be handled by TCP stack witout problems (sequence numbers are ok). And here is one when connecting to google.com: 01:19:00.639216 win2k.3064 google.com.80: S 4253018133:4253018133(0) win 16384 mss 1460,nop,nop,sackOK (DF) 01:19:00.748937 google.com.80 win2k.3064: S 1190391422:1190391422(0) ack 4253018134 win 8190 mss 1460 01:19:00.749137 win2k.3064 google.com.80: . ack 1 win 17520 (DF) 01:19:00.749239 win2k.3064 google.com.80: P 1:19(18) ack 1 win 17520 (DF) 01:19:00.749324 win2k.3064 google.com.80: F 19:19(0) ack 1 win 17520 (DF) 01:19:00.868893 google.com.80 win2k.3064: P 1:592(591) ack 20 win 31460 01:19:00.869221 win2k.3064 google.com.80: R 4253018153:4253018153(0) win 0 (DF) In both cases http reply is sent by server, but client answers with RST instead of ACK. For reference here are dumps generated by running the same code on FreeBSD box: 01:23:47.548080 bsd.49159 example.org.80: S 2808270330:2808270330(0) win 65535 mss 1460,nop,wscale 1,nop,nop,timestamp 383076 0 (DF) 01:23:47.739494 example.org.80 bsd.49159: S 3999683607:3999683607(0) ack 2808270331 win 5792 mss 1460,nop,nop,timestamp 11166371 383076,nop,wscale 0 (DF) 01:23:47.739559 bsd.49159 example.org.80: . ack 1 win 33304 nop,nop,timestamp 383095 11166371 (DF) 01:23:47.739631 bsd.49159 example.org.80: P 1:19(18) ack 1 win 33304 nop,nop,timestamp 383095 11166371 (DF) 01:23:47.739647 bsd.49159 example.org.80: F 19:19(0) ack 1 win 33304 nop,nop,timestamp 383095 11166371 (DF) 01:23:47.926501 example.org.80 bsd.49159: . ack 19 win 5792 nop,nop,timestamp 11166468 383095 (DF) 01:23:47.927939 example.org.80 bsd.49159: F 703:703(0) ack 19 win 5792 nop,nop,timestamp 11166468 383095 (DF) 01:23:47.927980 bsd.49159 example.org.80: F 19:19(0) ack 1 win 33304 nop,nop,timestamp 383114 11166468 (DF) 01:23:47.931289 example.org.80 bsd.49159: P 1:703(702) ack 19 win 5792 nop,nop,timestamp 11166468 383095 (DF) 01:23:47.931318 bsd.49159 example.org.80: F 19:19(0) ack 704 win 32953 nop,nop,timestamp 383114 11166468 (DF) 01:23:47.934490 example.org.80 bsd.49159: . ack 20 win 5792 nop,nop,timestamp 11166468 383095 (DF) 01:23:48.122954 example.org.80 bsd.49159: . ack 20 win 5792 nop,nop,timestamp 11166569 383114 (DF) 01:25:41.588049 bsd.49161 google.com.80: S 2950247753:2950247753(0) win 65535 mss 1460,nop,wscale 1,nop,nop,timestamp 562478 0 (DF) 01:25:41.725996 google.com.80 bsd.49161: S 1587602094:1587602094(0) ack 2950247754 win 8190 mss 1460 01:25:41.726052 bsd.49161 google.com.80: . ack 1 win 65535 (DF) 01:25:41.726122 bsd.49161 google.com.80: P 1:19(18) ack 1 win 65535 (DF) 01:25:41.726144 bsd.49161 google.com.80: F 19:19(0) ack 1 win 65535 (DF) 01:25:41.847393 google.com.80 bsd.49161: P 1:592(591) ack 20 win 31460 01:25:41.941043 bsd.49161 google.com.80: . ack 592 win 65535 (DF) 01:25:42.054825 google.com.80 bsd.49161: F 592:592(0) ack 20 win 31460 01:25:42.054863 bsd.49161 google.com.80: . ack 593 win 65534 (DF) Regards, Jacek. -- 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/
Re: shutdown( socket, SHUT_WR ) - unexpected behaviour
Hi, Just kind of wondering if the apache is prematurely dropping the line when it sees the FIN. Possible, but I suspect it's a problem on Jacek's machine. Yep, that's most likely. Jacek: Win2K SP2 is pretty ancient. Is it possible to try this on a later SP? (SP4 is the latest, and there have been numerous hotfixes since it was released.) I'll try with SP4 later today. If upgrading is not feasible, would it be possible for you to capture the actual on-the-wire network traffic? That would absolutely pinpoint the guilty culprit. In my other mail: http://cygwin.com/ml/cygwin/2004-05/msg00125.html Best regards, Jacek. -- 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/
Re: shutdown( socket, SHUT_WR ) - unexpected behaviour
Hannu E K Nevalainen wrote: $ g++ ShutdownTest.cpp -o ShutdownTest ./ShutdownTest.exe HTTP/1.1 200 OK Date: Tue, 04 May 2004 14:02:39 GMT Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT [...] $ uname -a CYGWIN_NT-5.0 P450 1.5.10s(0.114/4/2) 20040420 11:21:06 i686 unknown unknown Cygwin That is: 1.5.9-1, recently updated but still with the 20040420 snapshot dll. Running on Win 2K advanced server, SP4 plus updates. Thanks for help. Best regards, Jacek. -- 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/
Re: shutdown( socket, SHUT_WR ) - unexpected behaviour - RESOLVED
Possible, but I suspect it's a problem on Jacek's machine. Jacek: Win2K SP2 is pretty ancient. Is it possible to try this on a later SP? (SP4 is the latest, and there have been numerous hotfixes since it was released.) I've installed SP4 (had most of hotfixes already) but it didn't fix problem. However I found source of bug. Norton Internet Security was messing with sockets. Removing NIS related entries in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\ and rebooting did solve problem. So, bye bye NIS, will have to tighten ifpw instead. Thanks all for help. Best regards, Jacek. -- 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/
Re: shutdown( socket, SHUT_WR ) - unexpected behaviour
I've tried your application and I'm not able to reproduce your problem. The shutdown call does not influence sending the buffered data apparently. Thanks for info. I've tested with Cygwin 1.5.9 and with a recent snapshot on XP SP1. What's your system? Cygwin 1.5.9, Win2kSP2. I made additional test using winsock directly and got the same buggy result. So it doesn't look like bug in cygwin, but rather in windows or some 3rd party app that is messing with the sockets (e.g. NIS). I found similar bugreport in MS KB298871, but it's marked as WinCE only: http://support.microsoft.com/default.aspx?scid=kb;en-us;298871 If an application calls shutdown() to disable only sending from the socket, later attempts to read data sent to that socket will result in only portions of the data being received. Can somebody with Win2k box compile and run prog from my previous mail? I would like to know if it behaves incorrectly only on my system, or on Win2k in general: http://cygwin.com/ml/cygwin/2004-05/msg00013.html $ g++ ShutdownTest.cpp -o ShutdownTest ./ShutdownTest.exe No output will mean that shutdown bug is present. 1. I suppose that shutdown(sd,SHUT_WR) does not force unflushed buffers out (i.e. discards them). Am I right? It doesn't flush, but it also doesn't stop the data already buffered from being sent. It's only purpose is to disallow further send calls on the socket. Yes, it works this way in practice (to have other reference, I've just tested in on FreeBSD). I was unsure only because unix documentation I found was silent about this. The only place I found now that declares it clearly is MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/shutdown_2.asp If the how parameter is SD_SEND, subsequent calls to the send function are disallowed. For TCP sockets, a FIN will be sent after all data is sent and acknowledged by the receiver. Regards, Jacek. -- 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/
shutdown( socket, SHUT_WR ) - unexpected behaviour
Hi, $ cygcheck -cd cygwin Cygwin Package Information Package Version cygwin 1.5.9-1 I found some unexpected behaviour of shutdown call. Here is example program to reproduce problem. It is supposed to send simple http request to example.org, close writing part of socket, and then wait for and print reply: --- ShutdownTest.cpp #include stdio.h #include stdlib.h #include unistd.h #include sys/types.h #include sys/socket.h #include netinet/in.h #include netdb.h #include string.h #include assert.h const char *HOST= example.org; const int PORT= 80; const char *MESSAGE = GET / HTTP/1.0\r\n\r\n; void sendall( int sd, const char *data, int datalen ) { assert( data ); assert( datalen = 0 ); while(datalen0) { int sent = send(sd, data, datalen, 0); if( sent == -1) { perror(send); exit(1); } data += sent; datalen -= sent; assert( datalen=0 ); } } void recvandprintall( int sd ) { const int bufferlen = 65536; char buffer[bufferlen]; while(true) { int got = recv(sd, buffer, bufferlen, 0); if(got == -1) { perror(recv); exit(1); } if(got==0) { break; } for( int i=0; igot; ++i) { printf( %c, buffer[i] ); } } } void test() { /* go find out about the desired host machine */ struct hostent *he = gethostbyname(HOST); if (he == 0) { perror(gethostbyname); exit(1); } assert( he-h_addrtype == AF_INET ); assert( he-h_addr_list[0] ); /* fill in the socket structure with host information */ struct sockaddr_in pin; memset( pin, 0, sizeof(pin) ); pin.sin_family = AF_INET; pin.sin_addr.s_addr = ((struct in_addr *)(he-h_addr))-s_addr; pin.sin_port = htons(PORT); /* grab an Internet domain socket */ int sd; if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { perror(socket); exit(1); } /* connect to PORT on HOST */ if (connect(sd,(struct sockaddr *) pin, sizeof(pin)) == -1) { perror(connect); exit(1); } /* send a message to the server PORT on machine HOST */ sendall( sd, MESSAGE, strlen(MESSAGE) ); /* shutdown writing part of socket */ shutdown( sd, SHUT_WR ); /* wait for data to come back from the server and print it */ recvandprintall( sd ); close(sd); } int main() { test(); return 0; } --- ShutdownTest.cpp If you compile and run it this way: $ g++ ShutdownTest.cpp -o ShutdownTest ./ShutdownTest.exe it doesn't print anything. Commenting out shutdown call or adding some wait before it does make program work as expected: $ g++ ShutdownTest.cpp -o ShutdownTest ./ShutdownTest.exe HTTP/1.1 200 OK Date: Sat, 01 May 2004 23:28:20 GMT Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT [...] 1. I suppose that shutdown(sd,SHUT_WR) does not force unflushed buffers out (i.e. discards them). Am I right? 2. Is this bug or feature? Manual page isn't helpful: $ man 2 shutdown No entry for shutdown in section 2 of the manual $ man shutdown No manual entry for shutdown 3. If it's a feature, then how can I manually flush buffers out before calling shutdown? I've googled for this problem, but haven't found any relevant information. Best regards, Jacek. -- 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/