SECURITY: tiff

2011-04-03 Thread Yaakov (Cygwin/X)
Chuck,

Security vulnerabilities have been announced in the tiff package.  The
remedy is to update to the latest 3.9.4 release AND apply the following
patches:

http://pkgs.fedoraproject.org/gitweb/?p=libtiff.git;a=blob_plain;f=libtiff-CVE-2011-0192.patch
http://pkgs.fedoraproject.org/gitweb/?p=libtiff.git;a=blob_plain;f=libtiff-CVE-2011-1167.patch

Further information:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-0192
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1167


Yaakov




[PATCH] reorder major-0 devices (was Re: [PATCH] implement /proc/sysvipc/*)

2011-04-03 Thread Yaakov (Cygwin/X)
On Fri, 2011-04-01 at 23:33 +0200, Corinna Vinschen wrote:
 On Apr  1 14:57, Yaakov (Cygwin/X) wrote:
  For the sake of clarity, I would reorder it a bit further to
  make FH_PROC and friends to one side of major-0 and everything else to
  the other side:
  
/* begin /proc directories */
FH_PROC= FHDEV (0, 255),
FH_REGISTRY= FHDEV (0, 254),
FH_PROCNET = FHDEV (0, 253),
FH_PROCESSFD = FHDEV (0, 252),
FH_PROCSYS = FHDEV (0, 251),
FH_PROCSYSVIPC = FHDEV (0,250),
  
FH_PROC_MIN_MINOR = FHDEV (0,200),
/* end /proc directories */
  
FH_PIPE= FHDEV (0, 199),
FH_PIPER   = FHDEV (0, 198),
FH_PIPEW   = FHDEV (0, 197),
FH_FIFO= FHDEV (0, 196),
FH_PROCESS = FHDEV (0, 195),
FH_FS  = FHDEV (0, 194),  /* filesystem based device */
FH_NETDRIVE= FHDEV (0, 193),
FH_DEV = FHDEV (0, 192),
  
  As either way this should be a separate changeset IMHO, I have committed
  my patch as is and will follow this up on Sunday.
 
 Sounds ok to me.

Patch attached.


Yaakov

2011-03-04  Yaakov Selkowitz  yselkow...@users.sourceforge.net
	Corinna Vinschen  cori...@vinschen.de

	* devices.h (fh_devices): Define FH_PROC_MIN_MINOR.
	Reorder major-0 devices so that all /proc directories fall
	between FH_PROC and FH_PROC_MIN_MINOR.
	* path.h (isproc_dev): Redefine accordingly.

Index: devices.h
===
RCS file: /cvs/src/src/winsup/cygwin/devices.h,v
retrieving revision 1.27
diff -u -r1.27 devices.h
--- devices.h	1 Apr 2011 19:48:19 -	1.27
+++ devices.h	3 Apr 2011 21:46:44 -
@@ -1,6 +1,6 @@
 /* devices.h
 
-   Copyright 2002, 2003, 2004, 2005, 2007, 2009, 2010 Red Hat, Inc.
+   Copyright 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2011 Red Hat, Inc.
 
 This file is part of Cygwin.
 
@@ -39,22 +39,25 @@
   FH_WINDOWS = FHDEV (13, 255),
   FH_CLIPBOARD=FHDEV (13, 254),
 
-  FH_PIPE= FHDEV (0, 255),
-  FH_PIPER   = FHDEV (0, 254),
-  FH_PIPEW   = FHDEV (0, 253),
-  FH_FIFO= FHDEV (0, 252),
-  FH_PROC= FHDEV (0, 250),
-  FH_REGISTRY= FHDEV (0, 249),
-  FH_PROCESS = FHDEV (0, 248),
-
-  FH_FS  = FHDEV (0, 247),	/* filesystem based device */
-
-  FH_NETDRIVE= FHDEV (0, 246),
-  FH_DEV = FHDEV (0, 245),
-  FH_PROCNET = FHDEV (0, 244),
-  FH_PROCESSFD = FHDEV (0, 243),
-  FH_PROCSYS = FHDEV (0, 242),
-  FH_PROCSYSVIPC = FHDEV (0,241),
+  /* begin /proc directories */
+  FH_PROC= FHDEV (0, 255),
+  FH_REGISTRY= FHDEV (0, 254),
+  FH_PROCNET = FHDEV (0, 253),
+  FH_PROCESSFD = FHDEV (0, 252),
+  FH_PROCSYS = FHDEV (0, 251),
+  FH_PROCSYSVIPC = FHDEV (0,250),
+
+  FH_PROC_MIN_MINOR = FHDEV (0,200),
+  /* end /proc directories */
+
+  FH_PIPE= FHDEV (0, 199),
+  FH_PIPER   = FHDEV (0, 198),
+  FH_PIPEW   = FHDEV (0, 197),
+  FH_FIFO= FHDEV (0, 196),
+  FH_PROCESS = FHDEV (0, 195),
+  FH_FS  = FHDEV (0, 194),  /* filesystem based device */
+  FH_NETDRIVE= FHDEV (0, 193),
+  FH_DEV = FHDEV (0, 192),
 
   DEV_FLOPPY_MAJOR = 2,
   FH_FLOPPY  = FHDEV (DEV_FLOPPY_MAJOR, 0),
Index: path.h
===
RCS file: /cvs/src/src/winsup/cygwin/path.h,v
retrieving revision 1.155
diff -u -r1.155 path.h
--- path.h	1 Apr 2011 19:48:19 -	1.155
+++ path.h	3 Apr 2011 21:46:44 -
@@ -18,8 +18,7 @@
 #include fcntl.h
 
 #define isproc_dev(devn) \
-  (devn == FH_PROC || devn == FH_REGISTRY || devn == FH_PROCESS || \
-   devn == FH_PROCNET || devn == FH_PROCSYS || devn == FH_PROCSYSVIPC)
+  (devn = FH_PROC_MIN_MINOR  devn = FH_PROC)
 
 #define isprocsys_dev(devn) (devn == FH_PROCSYS)
 


[PATCH] fix make after clean

2011-04-03 Thread Yaakov (Cygwin/X)
If you run make clean in winsup/cygwin followed by make -jX, the build
fails because devices.cc is not found; it was removed by make clean but
nothing forced it to be regenerated in time.

Patch attached.


Yaakov

2011-04-03  Yaakov Selkowitz  yselkow...@users.sourceforge.net

	* Makefile.in (devices.o): New rule with dependency on devices.cc
	to assure that the latter exists and is current.

Index: Makefile.in
===
RCS file: /cvs/src/src/winsup/cygwin/Makefile.in,v
retrieving revision 1.243
diff -u -r1.243 Makefile.in
--- Makefile.in	1 Apr 2011 19:48:19 -	1.243
+++ Makefile.in	3 Apr 2011 21:33:27 -
@@ -443,6 +443,9 @@
 $(srcdir)/devices.cc: gendevices devices.in devices.h
 	${wordlist 1,2,$^} $@
 
+devices.o: $(srcdir)/devices.cc
+	$(COMPILE_CXX) -o $@ $
+
 ${CURDIR}/libc.a: ${LIB_NAME} ./libm.a libpthread.a libutil.a
 	${speclib} -v ${@F}
 


[PATCH] make sys/sysmacros.h compatible with glibc

2011-04-03 Thread Yaakov (Cygwin/X)
When building Qt Creator, I encountered a compile error because its code
uses 'major' and 'minor' as variable names.  Looking at the current
sys/sysmacros.h, which is pulled in automatically by sys/types.h,
makes it obvious why that doesn't work.

Since this code obviously compiles on Linux, I investigated further,
starting with:

http://www.kernel.org/doc/man-pages/online/pages/man3/minor.3.html

and running some tests on a Linux system.  In short, with glibc:

1) these are indeed macros, but;
2) the [name] macros point to gnu_dev_[name] functions;
3) the latter are defined as inline functions in sys/sysmacros.h;
4) the inline functions are used only if optimization is on.

Based on this, I refactored our existing macros into both inline and
normal functions.  An additional benefit is type-checking in the
arguments and return types of these functions.

Patches for winsup/cygwin and winsup/doc attached.


Yaakov

2011-04-03  Yaakov Selkowitz  yselkow...@users.sourceforge.net

	* include/cygwin/types.h: Move #include sys/sysmacros.h to
	end of header so the latter get the dev_t typedef.
	* include/sys/sysmacros.h (gnu_dev_major, gnu_dev_minor,
	gnu_dev_makedev): Prototype and define as inline functions.
	(major, minor, makedev): Redefine in terms of gnu_dev_*.
	* miscfuncs.cc (gnu_dev_major, gnu_dev_minor, gnu_dev_makedev):
	New functions.
	* cygwin.din (gnu_dev_major, gnu_dev_minor, gnu_dev_makedev): Export.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* posix.sgml (std-gnu): Add gnu_dev_major, gnu_dev_minor, gnu_dev_makedev.

Index: cygwin.din
===
RCS file: /cvs/src/src/winsup/cygwin/cygwin.din,v
retrieving revision 1.234
diff -u -r1.234 cygwin.din
--- cygwin.din	29 Mar 2011 10:32:40 -	1.234
+++ cygwin.din	3 Apr 2011 20:43:11 -
@@ -802,6 +802,9 @@
 _gmtime = gmtime SIGFE
 gmtime_r SIGFE
 _gmtime_r = gmtime_r SIGFE
+gnu_dev_major NOSIGFE
+gnu_dev_makedev NOSIGFE
+gnu_dev_minor NOSIGFE
 grantpt NOSIGFE
 hcreate SIGFE
 hcreate_r SIGFE
Index: miscfuncs.cc
===
RCS file: /cvs/src/src/winsup/cygwin/miscfuncs.cc,v
retrieving revision 1.58
diff -u -r1.58 miscfuncs.cc
--- miscfuncs.cc	12 Mar 2010 23:13:47 -	1.58
+++ miscfuncs.cc	3 Apr 2011 20:43:20 -
@@ -1,7 +1,7 @@
 /* miscfuncs.cc: misc funcs that don't belong anywhere else
 
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006, 2007, 2008 Red Hat, Inc.
+   2005, 2006, 2007, 2008, 2010, 2011 Red Hat, Inc.
 
 This file is part of Cygwin.
 
@@ -9,6 +9,7 @@
 Cygwin license.  Please consult the file CYGWIN_LICENSE for
 details. */
 
+#define __INSIDE_CYGWIN_GNU_DEV__
 #include winsup.h
 #include miscfuncs.h
 #include sys/uio.h
@@ -380,3 +381,21 @@
 *dst++ = '/';
   *dst++ = 0;
 }
+
+extern C int
+gnu_dev_major(dev_t dev)
+{
+	return (int)(((dev)  16)  0x);
+}
+
+extern C int
+gnu_dev_minor(dev_t dev)
+{
+	return (int)((dev)  0x);
+}
+
+extern C dev_t
+gnu_dev_makedev(int maj, int min)
+{
+	return (((maj)  16) | ((min)  0x));
+}
Index: include/cygwin/types.h
===
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/types.h,v
retrieving revision 1.33
diff -u -r1.33 types.h
--- include/cygwin/types.h	29 Mar 2011 10:32:40 -	1.33
+++ include/cygwin/types.h	3 Apr 2011 20:43:20 -
@@ -17,7 +17,6 @@
 #ifndef _CYGWIN_TYPES_H
 #define _CYGWIN_TYPES_H
 
-#include sys/sysmacros.h
 #include stdint.h
 #include endian.h
 
@@ -220,6 +219,8 @@
 #endif /* __INSIDE_CYGWIN__ */
 #endif /* _CYGWIN_TYPES_H */
 
+#include sys/sysmacros.h
+
 #ifdef __cplusplus
 }
 #endif
Index: include/cygwin/version.h
===
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/version.h,v
retrieving revision 1.339
diff -u -r1.339 version.h
--- include/cygwin/version.h	29 Mar 2011 10:32:40 -	1.339
+++ include/cygwin/version.h	3 Apr 2011 20:43:20 -
@@ -403,12 +403,13 @@
   237: Export strchrnul.
   238: Export pthread_spin_destroy, pthread_spin_init, pthread_spin_lock,
 	   pthread_spin_trylock, pthread_spin_unlock.
+  239: Export gnu_dev_major, gnu_dev_minor, gnu_dev_makedev.
  */
 
  /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 238
+#define CYGWIN_VERSION_API_MINOR 239
 
  /* There is also a compatibity version number associated with the
 	shared memory regions.  It is incremented when incompatible
Index: include/sys/sysmacros.h
===
RCS file: /cvs/src/src/winsup/cygwin/include/sys/sysmacros.h,v
retrieving revision 1.4
diff -u -r1.4 sysmacros.h
--- include/sys/sysmacros.h	26 Feb 2010 09:36:21 -	1.4
+++ include/sys/sysmacros.h	3 Apr 2011 20:43:20 -
@@ -1,6 +1,6 @@
 /* 

Re: [PATCH] make sys/sysmacros.h compatible with glibc

2011-04-03 Thread Christopher Faylor
On Sun, Apr 03, 2011 at 06:37:25PM -0500, Yaakov (Cygwin/X) wrote:
When building Qt Creator, I encountered a compile error because its code
uses 'major' and 'minor' as variable names.  Looking at the current
sys/sysmacros.h, which is pulled in automatically by sys/types.h,
makes it obvious why that doesn't work.

Since this code obviously compiles on Linux, I investigated further,
starting with:

http://www.kernel.org/doc/man-pages/online/pages/man3/minor.3.html

and running some tests on a Linux system.  In short, with glibc:

1) these are indeed macros, but;
2) the [name] macros point to gnu_dev_[name] functions;
3) the latter are defined as inline functions in sys/sysmacros.h;
4) the inline functions are used only if optimization is on.

Based on this, I refactored our existing macros into both inline and
normal functions.  An additional benefit is type-checking in the
arguments and return types of these functions.

Patches for winsup/cygwin and winsup/doc attached.


Yaakov


2011-04-03  Yaakov Selkowitz  yselkow...@users.sourceforge.net

   * include/cygwin/types.h: Move #include sys/sysmacros.h to
   end of header so the latter get the dev_t typedef.
   * include/sys/sysmacros.h (gnu_dev_major, gnu_dev_minor,
   gnu_dev_makedev): Prototype and define as inline functions.
   (major, minor, makedev): Redefine in terms of gnu_dev_*.
   * miscfuncs.cc (gnu_dev_major, gnu_dev_minor, gnu_dev_makedev):
   New functions.
   * cygwin.din (gnu_dev_major, gnu_dev_minor, gnu_dev_makedev): Export.
   * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
   * posix.sgml (std-gnu): Add gnu_dev_major, gnu_dev_minor, 
 gnu_dev_makedev.

Index: cygwin.din
===
RCS file: /cvs/src/src/winsup/cygwin/cygwin.din,v
retrieving revision 1.234
diff -u -r1.234 cygwin.din
--- cygwin.din 29 Mar 2011 10:32:40 -  1.234
+++ cygwin.din 3 Apr 2011 20:43:11 -
@@ -802,6 +802,9 @@
 _gmtime = gmtime SIGFE
 gmtime_r SIGFE
 _gmtime_r = gmtime_r SIGFE
+gnu_dev_major NOSIGFE
+gnu_dev_makedev NOSIGFE
+gnu_dev_minor NOSIGFE
 grantpt NOSIGFE
 hcreate SIGFE
 hcreate_r SIGFE
Index: miscfuncs.cc
===
RCS file: /cvs/src/src/winsup/cygwin/miscfuncs.cc,v
retrieving revision 1.58
diff -u -r1.58 miscfuncs.cc
--- miscfuncs.cc   12 Mar 2010 23:13:47 -  1.58
+++ miscfuncs.cc   3 Apr 2011 20:43:20 -
@@ -1,7 +1,7 @@
 /* miscfuncs.cc: misc funcs that don't belong anywhere else
 
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006, 2007, 2008 Red Hat, Inc.
+   2005, 2006, 2007, 2008, 2010, 2011 Red Hat, Inc.
 
 This file is part of Cygwin.
 
@@ -9,6 +9,7 @@
 Cygwin license.  Please consult the file CYGWIN_LICENSE for
 details. */
 
+#define __INSIDE_CYGWIN_GNU_DEV__

I'd prefer a more descriptive name like __DONT_DEFINE_INLINE_GNU_DEV but,
then again, why do these have to be exported?  Why can't they just be always
inlined?

cgf


[PATCH] add information to /proc/version

2011-04-03 Thread Yaakov (Cygwin/X)
On Linux, /proc/version also displays the username of the kernel
compiler and the version of gcc used to compile[1].  This patch does the
same for Cygwin:

$ cat /proc/version
CYGWIN_NT-6.1-WOW64 version 1.7.10(0.238/5/3) (Yaakov@YAAKOV04) (gcc
version 4.5.2 (GCC) ) 2011-03-30 18:56

Patches for winsup/cygwin and winsup/doc attached.


Yaakov

[1] 
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-proc-version.html

2011-04-03  Yaakov Selkowitz  yselkow...@users.sourceforge.net

	* new-features.sgml (ov-new1.7.10): Document additional information
	in /proc/version.

Index: new-features.sgml
===
RCS file: /cvs/src/src/winsup/doc/new-features.sgml,v
retrieving revision 1.71
diff -u -r1.71 new-features.sgml
--- new-features.sgml	1 Apr 2011 19:49:16 -	1.71
+++ new-features.sgml	3 Apr 2011 23:55:49 -
@@ -20,6 +20,15 @@
 shared memory.
 /para/listitem
 
+listitempara
+/proc/version now shows the username of whomever compiled the Cygwin DLL
+as well as the version of GCC used when compiling.
+/para/listitem
+
 /itemizedlist
 
 /sect2
2011-04-03  Yaakov Selkowitz  yselkow...@users.sourceforge.net

	* Makefile.in (fhandler_proc_CFLAGS): Define USERNAME, HOSTNAME,
	and GCC_VERSION.
	* fhandler_proc.cc (format_proc_version):  Add build machine and GCC
	version information as on Linux.

Index: Makefile.in
===
RCS file: /cvs/src/src/winsup/cygwin/Makefile.in,v
retrieving revision 1.243
diff -u -r1.243 Makefile.in
--- Makefile.in	1 Apr 2011 19:48:19 -	1.243
+++ Makefile.in	3 Apr 2011 23:38:41 -
@@ -287,6 +287,9 @@
 uinfo_CFLAGS:=-fomit-frame-pointer
 endif
 
+fhandler_proc_CFLAGS+=-DUSERNAME=\$(USER)\ -DHOSTNAME=\$(HOSTNAME)\
+fhandler_proc_CFLAGS+=-DGCC_VERSION=\`$(CC) -v 21 | tail -n 1`\
+
 _cygwin_crt0_common_STDINCFLAGS:=yes
 libstdcxx_wrapper_STDINCFLAGS:=yes
 cxx_STDINCFLAGS:=yes
Index: fhandler_proc.cc
===
RCS file: /cvs/src/src/winsup/cygwin/fhandler_proc.cc,v
retrieving revision 1.98
diff -u -r1.98 fhandler_proc.cc
--- fhandler_proc.cc	2 Apr 2011 11:32:55 -	1.98
+++ fhandler_proc.cc	3 Apr 2011 23:38:41 -
@@ -361,15 +361,19 @@
 static _off64_t
 format_proc_version (void *, char *destbuf)
 {
+  tmp_pathbuf tp;
+  char *buf = tp.c_get ();
+  char *bufptr = buf;
   struct utsname uts_name;
 
   uname (uts_name);
-  destbuf = (char *) crealloc_abort (destbuf, strlen (uts_name.sysname)
-	  + strlen (uts_name.release)
-	  + strlen (uts_name.version)
-	  + 4);
-  return __small_sprintf (destbuf, %s %s %s\n,
-			  uts_name.sysname, uts_name.release, uts_name.version);
+  bufptr += __small_sprintf (bufptr, %s version %s (%s@%s) (%s) %s\n,
+			  uts_name.sysname, uts_name.release, USERNAME, HOSTNAME,
+			  GCC_VERSION, uts_name.version);
+
+  destbuf = (char *) crealloc_abort (destbuf, bufptr - buf);
+  memcpy (destbuf, buf, bufptr - buf);
+  return bufptr - buf;
 }
 
 static _off64_t


Re: [PATCH] make sys/sysmacros.h compatible with glibc

2011-04-03 Thread Yaakov (Cygwin/X)
On Sun, 2011-04-03 at 19:55 -0400, Christopher Faylor wrote:
 +#define __INSIDE_CYGWIN_GNU_DEV__
 
 I'd prefer a more descriptive name like __DONT_DEFINE_INLINE_GNU_DEV 

The __INSIDE_CYGWIN_foo__ naming scheme seems to be what is used
elsewhere for similar purposes, hence my choice here.

 but, then again, why do these have to be exported?  Why can't they just be
 always inlined?

I just followed what I observed with glibc:

$ cat test.c 
#include sys/types.h
#include stdio.h

int
main(void)
{
  int maj = 4, min = 64;/* /dev/ttyS0 */
  printf(%d, %d = %d\n, maj, min, makedev(maj, min));
  return 0;
}

$ gcc -O0 test.c

$ nm a.out | grep  U 
 U __libc_start_main@@GLIBC_2.0
 U gnu_dev_makedev@@GLIBC_2.3.3
 U printf@@GLIBC_2.0

$ gcc -O1 test.c 

$ nm a.out | grep  U 
 U __libc_start_main@@GLIBC_2.0
 U printf@@GLIBC_2.0

Yaakov




Re: [PATCH] fix make after clean

2011-04-03 Thread Yaakov (Cygwin/X)
On Sun, 2011-04-03 at 19:03 -0400, Christopher Faylor wrote:
 This can't be right.  In all of the times that I've run a make clean,
 I have never needed this.  A .o relying on .cc is a given.  You don't
 need an explicit rule.

Without it, after a successfully completed build:

$ make clean -C i686-pc-cygwin/winsup/cygwin
[...]
$ make
[...goes until winsup/cygwin...]
[...compiles all files until link stage...]
g++: devices.o: No such file or directory
make[3]: *** [cygwin0.dll] Error 1

So in this case, apparently it is.


Yaakov




Re: [PATCH] make sys/sysmacros.h compatible with glibc

2011-04-03 Thread Christopher Faylor
On Sun, Apr 03, 2011 at 07:11:51PM -0500, Yaakov (Cygwin/X) wrote:
On Sun, 2011-04-03 at 19:55 -0400, Christopher Faylor wrote:
 +#define __INSIDE_CYGWIN_GNU_DEV__
 
 I'd prefer a more descriptive name like __DONT_DEFINE_INLINE_GNU_DEV 

The __INSIDE_CYGWIN_foo__ naming scheme seems to be what is used
elsewhere for similar purposes, hence my choice here.

There is a __INSIDE_CYGWIN_NET__ which I apparently added ten years ago
but my ideas about naming have changed.  I also added
USE_SYS_TYPES_FD_SET which is closer to what I now prefer but it should
have had some leading underscores.

 but, then again, why do these have to be exported?  Why can't they just be
 always inlined?

I just followed what I observed with glibc:

$ cat test.c 
#include sys/types.h
#include stdio.h

int
main(void)
{
  int maj = 4, min = 64;   /* /dev/ttyS0 */
  printf(%d, %d = %d\n, maj, min, makedev(maj, min));
  return 0;
}

$ gcc -O0 test.c

$ nm a.out | grep  U 
 U __libc_start_main@@GLIBC_2.0
 U gnu_dev_makedev@@GLIBC_2.3.3
 U printf@@GLIBC_2.0

$ gcc -O1 test.c 

$ nm a.out | grep  U 
 U __libc_start_main@@GLIBC_2.0
 U printf@@GLIBC_2.0

Maybe the functions were added to gcc before it had the ability to force
inlining.

I'll leave it to Corinna but I'd prefer not adding YA export if we can
avoid it.

cgf


Re: [PATCH] fix make after clean

2011-04-03 Thread Christopher Faylor
On Mon, Apr 04, 2011 at 01:07:27AM -0400, Christopher Faylor wrote:
I *am* building on Linux, though, so maybe that's the difference.

Nope.  It works fine on Windows too.

cgf


Re: [PATCH] fix make after clean

2011-04-03 Thread Yaakov (Cygwin/X)
On Mon, 2011-04-04 at 01:07 -0400, Christopher Faylor wrote:
 On Sun, Apr 03, 2011 at 07:22:42PM -0500, Yaakov (Cygwin/X) wrote:
 Without it, after a successfully completed build:
 
 $ make clean -C i686-pc-cygwin/winsup/cygwin
 [...]
 $ make
 [...goes until winsup/cygwin...]
 [...compiles all files until link stage...]
 g++: devices.o: No such file or directory
 make[3]: *** [cygwin0.dll] Error 1
 
 So in this case, apparently it is.
 
 And, without it, I continue to build without problem.  I *am* building
 on Linux, though, so maybe that's the difference.

No, I duplicated this on Linux as well (after I tracked down a cocom
RPM), but that did make me think of other possibilities.  The difference
seems to be if you pass an absolute or relative path to the top-level
configure script; only in the latter does it fail as I described.  I
presume you've been using an absolute path?


Yaakov




[1.7.9] bash: warning: setlocale: LC_COLLATE: cannot change locale (FR)

2011-04-03 Thread Frédéric Bron
I have just upgraded to 1.7.9:
$ uname
CYGWIN_NT-5.1 VOR-CRV-01660 1.7.9(0.237/5/3) 2011-03-29 10:10 i686 Cygwin

I now get this message when starting mintty (C:\cygwin-1.7\bin\mintty.exe -):
-bash: warning: setlocale: LC_COLLATE: cannot change locale (FR)

The warning remains if .bashrc and .bash_profile are empty.
For some reason, even if I do not set it, I have LANG=FR.

I have also tried to add:
export LANG=C.UTF-8
and/or
export LC_ALL=C.UTF-8
in .bashrc but it does not change anything.

This worked fine with 1.7.8 with export LC_ALL=C.UTF-8 in .bashrc.

Thanks,

Frédéric

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: Suggestions to setup.exe

2011-04-03 Thread Andy Koppe
On 3 April 2011 03:44, Larry Hall (Cygwin) wrote:
 On 4/2/2011 12:44 PM, Tony wrote:

 Hi. I just installed this package here which brought with it a ton of
 dependancies. Why can't setup.exe, when I want to uninstall this
 package, also uninstall all the dependancies? Please make the next
 Cygwin release support clean uninstalls.

 That's not as easy as it might initially sound.  Uninstalling all
 dependencies
 might result in other utilities not working, since these dependencies could
 be
 shared.  Determining the dependencies to install is easier than determining
 those that are safe to uninstall.  So that's by way of explanation for why
 you
 see the behavior you currently see from 'setup.exe' when uninstalling a
 package.  That said, it is possible to figure out which dependencies could
 safely be uninstalled.

It depends. ;)

When uninstalling a package, it sure makes sense to uninstall all the
packages that depend on it, since they would stop working anyway. So
for example, removing the libX11 runtime would be a quick way to
remove all X11 programs.

However, removing a package because an uninstalled package depends on
is not generally a good idea, even if no other package depends on it.
That's because the user might still require it, either directly or
perhaps through a program they've built from source. For example,
mintty depends on cygutils (for its postinstall script), but removing
mintty doesn't mean that the user no longer wants to run cygstartCo.

Other package managers address this by keeping a record of which
packages were requested explicitly by the user and which were
installed implicitly as dependencies of other packages. Even then, the
user might come to depend on packages that were only installed
implicitly, so there's still scope for uninstalling packages
accidentally, but at least there's a simple remedy: explicitly request
such packages and it won't happen again.

In any case, improving support for uninstalling stuff isn't exactly a
new suggestion, and as usual, the real problem is:

http://www.cygwin.com/acronyms/#SHTDI

Andy

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: [1.7.9] bash: warning: setlocale: LC_COLLATE: cannot change locale (FR)

2011-04-03 Thread Andy Koppe
2011/4/3 Frédéric Bron:
 I have just upgraded to 1.7.9:
 $ uname
 CYGWIN_NT-5.1 VOR-CRV-01660 1.7.9(0.237/5/3) 2011-03-29 10:10 i686 Cygwin

 I now get this message when starting mintty (C:\cygwin-1.7\bin\mintty.exe 
 -):
 -bash: warning: setlocale: LC_COLLATE: cannot change locale (FR)

Check the locale setting on the Text page of mintty's options dialog.

 The warning remains if .bashrc and .bash_profile are empty.
 For some reason, even if I do not set it, I have LANG=FR.

 I have also tried to add:
 export LANG=C.UTF-8
 and/or
 export LC_ALL=C.UTF-8
 in .bashrc but it does not change anything.

That's because setting the locale there is too late both for mintty
and for bash.

Andy

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: [1.7.9] bash: warning: setlocale: LC_COLLATE: cannot change locale (FR)

2011-04-03 Thread Frédéric Bron
 I now get this message when starting mintty (C:\cygwin-1.7\bin\mintty.exe 
 -):
 -bash: warning: setlocale: LC_COLLATE: cannot change locale (FR)

 Check the locale setting on the Text page of mintty's options dialog.

It was empty. That now works fine. Thank you. I wonder why it was
working fine with 1.7.8...

Frédéric

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



[1.7.9] bash: warning: setlocale: LC_COLLATE: cannot change locale (FR)

2011-04-03 Thread Andy Koppe
On Monday, 4 April 2011, Frédéric Bron wrote:
 I now get this message when starting mintty (C:\cygwin-1.7\bin\mintty.exe 
 -):
 -bash: warning: setlocale: LC_COLLATE: cannot change locale (FR)

 Check the locale setting on the Text page of mintty's options dialog.

 It was empty.

Which is the default, in which case mintty uses the locale set in its
environment, or Cygwin's default locale if nothing is set. So this
probably means that something has set LANG to 'FR' in your Windows
environment. You could try confirming that in a Command Prompt.

 That now works fine.

You mean after setting the locale in the mintty options?

 Thank you.

You're welcome.

 I wonder why it was working fine with 1.7.8...

I don't think it's anything to do with the update. There's been no
relevant change, and there's no good reason why Cygwin would set a
locale like that. A valid one would be 'fr_FR'. I'd suspect some other
software you installed or updated around the same time. Another Unix
environment perhaps?

Andy

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: Zsh completion problem

2011-04-03 Thread Peter A. Castro

On Fri, 1 Apr 2011, Vikas Mishra wrote:

Greetings, Vikas,


Any suggestions anyone?
I would really like to have completion in my zsh shells. Incidentally
I installed from source in cygwin and still have the same issue. So I
don't believe it is a package issue. I think it may be a bigger issue
with my cygwin environment.


I think you're going to have to give me some examples of what completion
you are attempting.  I still can't make this fail no matter what I try.
Your .zcompdump looks fine to me and if I strip my config to be just
your example (uncommented, of course) I can't make it fail.


Regards,
Vikas

On Thu, Mar 24, 2011 at 7:23 PM, Vikas Mishra vik...@vikasmishra.org wrote:

Hello Peter,

Thanks for your response.

On Thu, Mar 24, 2011 at 6:36 PM, Peter A. Castro doc...@fruitbat.org wrote:

On Thu, 24 Mar 2011, Vikas Mishra wrote:

The ultimate cause of this particular problem was permissions on the
functions directories not being to zsh's liking (ie: having write
permission for group or other).  This was a build error on my part for
4.3.11-1, which was corrected in 4.3.11-2.
(Make sure you have installed 4.3.11-2, btw :-)


I just installed this cygwin installation today and I think 4.3.11-2
was release in early January so I believe I do have the latest
version.



With the permissions wrong, compinit fails to load any of the completion
functions and ends up creating a very, very abbreviated .zcompdump file
(less than 1k in size, versus  30k size).


In my case, the size of zcompdump was 32KB (I had forgotten to mention
it the first time around). I have attached the zcompdump file so that
you can see if this is correct or not.


You can tell this by looking at the .zcompdump and if it things like
_comps() are mostly empty, then you are hitting the problem.

Verify that you .zcompdump has move that a few functions in it and verify
the permissions on all directories under /usr/share/zsh/4.3.11 are 755
(rwxr-xr-x) and that all files under those directories are 644
(rw-r--r--).


I rechecked the permissions on the directories and they were correct.
I have also attached the smallest version of my zshrc which still has
a problem - basically this is just autoload -U compinit  compinit.

I installed version 4.3.10 (with the Cygwin installer and have the
same problem). Let me know if any more info will help.

Regards,
Vikas





--
Peter A. Castro doc...@fruitbat.org or peter.cas...@oracle.com
Cats are just autistic Dogs -- Dr. Tony Attwood
--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple

Utility: injob

2011-04-03 Thread Daniel Colascione
Attached is a small program that runs a set of processes under an NT job
object, allowing you to stop, resume, and kill them using normal Cygwin
job control --- whether or not these processes are Cygwin programs.

The program doesn't address every corner case, and programs run under
injob might behave strangely if they use job objects themselves.
Nevertheless, it suits my purposes, and it might be useful to others.
#define _WIN32_WINNT 0x0500 /*Win2k*/
#define STRICT

#include windows.h
#include stdio.h
#include getopt.h
#include sys/cygwin.h
#include sys/queue.h
#include process.h
#include unistd.h
#include sys/types.h
#include sys/wait.h
#include errno.h
#include Tlhelp32.h


#define PRGNAME injob
#define PRGVER 1.0
#define PRGAUTHOR Daniel Colascione dan.colasci...@gmail.com
#define PRGCOPY Copyright (C) 2011  PRGAUTHOR
#define PRGLICENSE GPLv2 or later http://www.gnu.org/licenses/gpl-2.0.html

/**
 * Small utility to run an arbitrary set of processes within a job
 * object.  We reach to Cygwin job control signals by appropriately
 * manipulating the job object, providing a crude form of job control
 * for Win32 applications being run from Cygwin programs.
 *
 * It works like this:
 *
 *   - Startup.
 *
 *   - Create a pipe with ends P_R and P_W.
 *
 *   - Block signals.
 *
 *   - Fork
 * 
 * * Child closes P_W, blocks reading P_R.  If it gets EOF, child
 *   knows parent died for some reason and exits without doing
 *   anything else.
 *
 * * Child reads 1 byte from pipe, indicating all-clear.
 *
 * * Child execs target program.
 * 
 *   - Meanwhile parent closes P_R and knows child is blocked on pipe.
 * 
 *   - Parent creates job object and puts the child
 * into it (child is still blocked).
 *
 *   - Parent gives all-clear signal to child by writing one byte to
 * P_W and closing it.
 *
 *   - Parent waits for SIGINT, SIGTERM, SIGCHLD, etc.
 *
 */

static BOOL WINAPI
(*XIsProcessInJob)(
HANDLE ProcessHandle,
HANDLE JobHandle,
PBOOL Result
);

#define CHK(op) \
({  \
int chk_ret;\
\
do {\
chk_ret = (op); \
} while (chk_ret == -1  errno == EINTR);  \
\
if (chk_ret == -1) {\
fprintf (stderr, PRGNAME :  #op : %s\n, \
 strerror (errno)); \
goto out;   \
}   \
chk_ret;\
})

#define CHK_W32_HANDLE(op)  \
({  \
HANDLE chk_ret = (op);  \
if (chk_ret == NULL ||  \
chk_ret == INVALID_HANDLE_VALUE)\
{   \
fprintf (stderr, PRGNAME :  #op : %s\n, \
 errmsg (GetLastError ())); \
goto out;   \
}   \
\
chk_ret;\
})

#define CHK_W32_BOOL(op)\
({  \
BOOL chk_ret = (op);\
if (chk_ret == FALSE) { \
fprintf (stderr, PRGNAME :  #op : %s\n, \
 errmsg (GetLastError ())); \
goto out;   \
}   \
\
chk_ret;\
})


#define PIPE_READ  0
#define PIPE_WRITE 1

struct suspend
{
DWORD   thread_id;
HANDLE  thread;

SLIST_ENTRY (suspend) entries;
};

static void
usage()
{
fprintf(
stdout, 
PRGNAME  PROGRAM ARG1 ARG2...: Run PROGRAM in a job object\n
\n
  PROGRAM will be run in a job object.  A SIGTERM or SIGINT sent to\n
  this proess will terminate PROGRAM and all its children.\n
\n
  Both Cygwin and non-Cygwin children will be terminated.\n
\n
PRGNAME  -h\n
PRGNAME  --help\n