Christopher Faylor | 25 May 05:53 2014

Re: Rename detached debug info as cygwin1.dll.dbg

On Fri, May 23, 2014 at 04:05:34PM +0200, Corinna Vinschen wrote:
>On May 23 14:40, Jon TURNEY wrote:
>> 
>> Not sure if this is wanted, and it obviously has some knock on effects on
>> package and snapshot generation.
>> 
>> But, cygport names detached debug info files by appending the .dbg suffix.
>> This is 'obviously correct' as it means that both a foo.exe and foo.dll can
>> exist and have detached debug info.
>> 
>> For consistency, the attached patch changes the name of the detached debug
>> info file for cygwin1.dll from cygwin1.dbg to cygwin1.dll.dbg
>
>As far as releases go, this is ok.  I'll just have to tweak the next
>cygport file slightly.
>
>Chris might have to tweak the snapshot generation script as well, so
>he probably wants to chime in, too.

It's more than just a tweak.  I've known that there is a discrepancy for
a long time but haven't considered it that big a deal.  I'd prefer that
this change not be made.

David Stacey | 25 May 00:00 2014
Picon

[PATCH] cygwin_rexec() returns pointer to deallocated memory

In function cygwin_rexec(), a pointer to local buffer 'ahostbuf' is 
returned through 'ahost'. However, the buffer will have been deallocated 
at the end of the function, and so the contents of 'ahost' will be 
undefined. A trivial patch (attached) fixes the problem by making 
'ahostbuf' static.

This patch fixes Coverity bug ID #60028.

Change Log:
2014-05-24  David Stacey  <drstacey <at> tiscali.co.uk>

         * libc/rexec.cc (cygwin_rexec):
         Corrected returning a pointer to a buffer that will have gone 
out of
         scope.

Cheers,

Dave.

--- cygwin-orig/libc/rexec.cc	2013-04-23 10:44:35.000000000 +0100
+++ cygwin/libc/rexec.cc	2014-05-24 22:37:39.764370000 +0100
 <at>  <at>  -317,7 +317,7  <at>  <at> 
 	u_short port = 0;
 	int s, timo = 1, s3;
 	char c;
-	char ahostbuf[INTERNET_MAX_HOST_NAME_LENGTH + 1];
+	static char ahostbuf[INTERNET_MAX_HOST_NAME_LENGTH + 1];
(Continue reading)

David Stacey | 18 May 21:12 2014
Picon

[PATCH] Buffer over-run fix for getusershell(3)

This is the first patch resulting from the Coverity Scan analysis of the 
Cygwin source code. The patch fixes Coverity ID 59932. Note that we 
don't have that many bugs in the Cygwin source code - that's just an ID 
that Coverity assigned to this issue. The patch is only a single line, 
so it falls into our definition of 'trivial'.

getusershell(3) returns the next line from the '/etc/shells' file [1]. 
This contains a path to an executable, so it makes sense for 'buf' to 
contain PATH_MAX characters.

Now, the definition of PATH_MAX is the maximum length of the path, 
including the null terminator [2]. So the for() loop should copy 
PATH_MAX-1 characters, in order to allow for the null terminator.

However, by copying PATH_MAX characters, there is a possible buffer 
over-run when the null terminator is applied. The patch (attached) 
corrects this.

Change Log:
2014-05-18  David Stacey  <drstacey <at> tiscali.co.uk>

         * winsup/cygwin/syscalls.cc(getusershell) :
         Fixed theoretical buffer overrun of 'buf' that would occur if
         /etc/shells contained a line longer than 4095 characters.

Cheers,

Dave.

[1] http://linux.die.net/man/3/getusershell
(Continue reading)

zosrothko | 2 May 15:40 2014
Picon

stdio.h patches for g++ -std=c++11

Hi

This is a patch for exposing the new stdio functions added by the c++11 
standard. Without this patch the snprintf for example is not exposed as

$ cat hello.cpp
#include <cstdio>

int main(int argc, char** argv) {
char buf[24];
snprintf(buf, 2, "", 2);
return 0;
}

$ g++ -std=c++11 hello.cpp
hello.cpp: In function ‘int main(int, char**)’:
hello.cpp:4:30: erreur: ‘snprintf’ was not declared in this scope
snprintf("", 2, "", 2);

$ g++ -xc++ -std=c++11 -dM -E - < /dev/null | sort | grep ANSI
#define __STRICT_ANSI__ 1

$ g++ -dM -E - < /dev/null | sort | grep ANSI

$

Regards

(Continue reading)

Jon TURNEY | 21 Apr 19:02 2014
Picon

[PATCH] minidumper patches


Attached are a couple of patches for the minidumper utility which could
probably use some review.

The first one changes to direct linkage with dbghelp, rather than using
GetProcAddress().

(This seems to be the current style, I assume since the reasons for not
directly linking (no import libs or Windows versions which don't have the
.dll) are no longer relevant.)

As suggested, the second one changes the default dump type to something with
more information that just MiniDumpNormal, without getting too big.

(This is complicated by the fact that it appears to be an error to call
MiniDumpWriteDump() with an unknown dump flag, but the documentation for which
dump flags are supported by which dbhelp.dll version and how
ImagehlpApiVersionEx() is supposed to work is not totally clear)
Link directly with dbghelp

2014-04-21  Jon TURNEY  <jon.turney <at> dronecode.org.uk>

	* Makefile.in (minidumper.exe): Link directly with dbghelp.
	* minidumper.cc (minidump): Ditto.

---
 utils/Makefile.in   |    1 +
 utils/minidumper.cc |   47 ++++++++++-------------------------------------
(Continue reading)

Weber, Mark | 20 Mar 22:10 2014

patch for command line containing equals sign


See
http://cygwin.com/ml/cygwin-patches/2014-q1/msg00017.html
and related.

Thanks for posting how the new behavior is different from the old.
I am having a related issue, with C++ code that parses the command line.

The command line we support is something like -
  program_name   arg1  -option1=val1  -option2=val2  ...

You get the idea.

Now, with the above mentioned Cygwin patch, we are seeing the input arguments

arg1  "-option1=val1"   "-option2=val2"  ...

If this were the extent of the issue, it would be no big deal to strip off the quotes. However, the user may have
put quotes on the command line himself, which Cygwin now moves around.
Such as:
  program_name  arg1  -option1="file name with spaces in it"

Is there any way to reliably tell what the user entered on the command line?

Oleg Kravtsov | 3 Mar 19:34 2014
Picon

[PATCH] Fix errno codes set by opendir() in case of problems with the path argument

Currently cygwin has a problem with errno code set by opendir() 
function. It always sets errno to ENOENT.
After applying the path opendir() sets errno to 'ENAMETOOLONG' when path 
or a path component is too long,
'ELOOP' when a loop of symbolic links exits in the path.

Best regards,
Oleg

2014-02-18  Oleg Kravtsov <Oleg.Kravtsov <at> oktetlabs.ru>

        * dir.cc (opendir): Set errno code depending on the type of an error
        instead of always setting it to ENOENT.

Attachment (opendir_errno_fix.patch): text/x-diff, 858 bytes
Ray Donnelly | 9 Feb 01:25 2014
Picon

[PATCH] Expand $CYGWIN error_start processing

I want to use QtCreator as my debugger but the hardcoded
nature of error_start makes that impossible.

This change allows a formatted commandline to be used where
'|' is used to represent spaces and <program-name> and
<process-id> are special tokens.

In my case, I set my CYGWIN env. var to
error_start:C:/Qt/bin/qtcreator.exe|-debug|<process-id>

.. note, QtCreator doesn't work if passed the program name
and must be invoked with the -debug option.

Ray Donnelly (1):
  * winsup/cygwin/exceptions.cc: Expand $CYGWIN error_start          
    processing so that custom commandlines can be passed to          
    the debugger program using '|' as an argument delimiter          
    and <program-name> and <process-id> as special tokens.

 winsup/cygwin/exceptions.cc | 50 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 46 insertions(+), 4 deletions(-)

--

-- 
1.8.5.4

Jon TURNEY | 7 Feb 17:36 2014
Picon

[PATCH] Add minidump write utility


This patch adds a 'minidumper' utility, which functions identically to
'dumper' except it writes a Windows minidump, rather than a core file.
	
I'm not sure if this is of use to anyone but me, but since I've had the patch
sitting around for a couple of years, here it is...

2014-02-07  Jon TURNEY  <jon.turney <at> dronecode.org.uk>

	* minidumper.cc: New file.
	* Makefile.in (CYGWIN_BINS): Add minidumper.
	* utils.xml (minidumper): New section.
Index: utils/Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/utils/Makefile.in,v
retrieving revision 1.113
diff -u -u -p -r1.113 Makefile.in
--- utils/Makefile.in	19 Nov 2013 11:14:36 -0000	1.113
+++ utils/Makefile.in	14 Jan 2014 00:01:13 -0000
 <at>  <at>  -56,7 +56,7  <at>  <at>  MINGW_CXX      :=  <at> MINGW_CXX <at> 

 # List all binaries to be linked in Cygwin mode.  Each binary on this list
 # must have a corresponding .o of the same name.
-CYGWIN_BINS := ${addsuffix .exe,cygpath getconf getfacl ldd locale kill mkgroup \
+CYGWIN_BINS := ${addsuffix .exe,cygpath getconf getfacl ldd locale kill minidumper mkgroup \
         mkpasswd mount passwd pldd ps regtool setfacl setmetamode ssp tzset umount}

 # List all binaries to be linked in MinGW mode.  Each binary on this list
(Continue reading)

Adam Dinwoodie | 29 Jan 17:46 2014

[PATCH] Snapshot install instructions use bz2, not xz

All,

I've attached a minor correction to the FAQ entry on installing
snapshots, to note that snapshots are now .xz archives, rather than
.bz2.

I've not been able to build this: the docs build requires "fop", which
isn't available in the main Cygwin repositories, and I don't
particularly want to set up this machine to start pulling packages from
Cygwin Ports.

2014-01-29  Adam Dinwoodie

	* faq-setup.xml (faq.setup.snapshots): Use .xz not .bz2.
Attachment (faq-patch.diff): text/x-diff, 1396 bytes
Daniel Dai | 20 Jan 07:02 2014
Picon

[PATCH] Fix parameter passing containing quote/equal to Windows batch command

We notice one issue when running a Windows batch command inside
cygwin. Here is one example.

Simple batch file:
a.bat:
echo %1

Run it under cygwin:
./a.bat a=b
a

./a.bat "a=b"
a

If we pass additional \"
./a.bat "\"a=b\""
"\"a

There seems no way to pass a=b into bat.

Attach quote.patch contains a fix. It does two things:
1. If the parameter contains a equal sign, automatically add quote
(similar to space, tab, new line, quote cygwin already do)
2. If the parameter is already quoted, don't quote again

Patch:
Index: cygwin/winf.cc
==============================
=====================================
RCS file: /cvs/src/src/winsup/cygwin/winf.cc,v
(Continue reading)


Gmane