bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Release of version 4.6.1-pre2 of sharutils


From: Eric Blake
Subject: Re: Release of version 4.6.1-pre2 of sharutils
Date: Tue, 15 Nov 2005 06:54:51 -0700
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruce Korb on 11/14/2005 9:53 PM:
>
> Version 4.6.1-pre2 - November 2005, by Bruce Korb

> 
> "uuencode" and "uudecode" are programs that convert binary files into
> ascii text so that the original data can pass through the email system
> without having intermediate hosts "fixing" the files en route.

The following patch is needed to make uu{en,de}code work on cygwin text
mounts, where binary and text mode are different.  Fixing shar/unshar is
more difficult, since bash does not like to parse shell code with \r\n
line endings, so the entry in the TODO about auditing text vs. binary is
still valid.

Also, the bootstrap script tries to execute with the non-typical
/usr/bash; a better choice would be /bin/bash or /usr/bin/bash.

2005-11-15  Eric Blake  <address@hidden>

        * uudecode.c (O_BINARY): Define for all platforms.
        (decode): Always open with binary, where it matters.
        * uuencode.c [__CYGWIN__]: Include io.h for setmode.
        (O_BINARY): Define for all platforms.
        (main): Always open with binary, where it matters.
        (main) [__CYGWIN__]: Use setmode to make stdin binary.


- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDeeir84KuGfSFAYARAu+AAJ94mfLHUucpV0uHqQMcXM+d2zgQVQCfTPYn
KA3NaQtYt2X7Teq/rLHFMBo=
=S4hz
-----END PGP SIGNATURE-----
Index: bootstrap
===================================================================
RCS file: /cvsroot/sharutils/sharutils/bootstrap,v
retrieving revision 1.34
diff -u -p -b -r1.34 bootstrap
--- bootstrap   15 Nov 2005 05:01:44 -0000      1.34
+++ bootstrap   15 Nov 2005 13:54:05 -0000
@@ -1,4 +1,4 @@
-#! /usr/bash
+#! /bin/bash
 
 # NOTE:  THIS FILE CONTAINS THE OFFICIAL SHARUTILS VERSION NUMBER
 # All others are reproductions of this number:
Index: src/uudecode.c
===================================================================
RCS file: /cvsroot/sharutils/sharutils/src/uudecode.c,v
retrieving revision 1.19
diff -u -p -b -r1.19 uudecode.c
--- src/uudecode.c      7 Jun 2005 21:54:04 -0000       1.19
+++ src/uudecode.c      15 Nov 2005 13:54:05 -0000
@@ -1,5 +1,5 @@
 /* uudecode utility.
-   Copyright (C) 1994, 1995, 1996, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 2002, 2005 Free Software Foundation, Inc.
 
    This product is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -67,6 +67,10 @@
 #include "gettext.h"
 #define _(str) gettext (str)
 
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
 /*=====================================================================\
 | uudecode [FILE ...]                                                 |
 |                                                                     |
@@ -374,7 +378,7 @@ decode (inname, forced_outname)
   /* Create output file and set mode.  */
 
   if (strcmp (outname, "/dev/stdout") != 0 && strcmp (outname, "-") != 0
-      && (freopen (outname, "w", stdout) == NULL
+      && (freopen (outname, O_BINARY ? "wb" : "w", stdout) == NULL
 #if HAVE_FCHMOD
          || fchmod (fileno (stdout), mode & (S_IRWXU | S_IRWXG | S_IRWXO))
 #else
Index: src/uuencode.c
===================================================================
RCS file: /cvsroot/sharutils/sharutils/src/uuencode.c,v
retrieving revision 1.13
diff -u -p -b -r1.13 uuencode.c
--- src/uuencode.c      7 Jun 2005 21:54:04 -0000       1.13
+++ src/uuencode.c      15 Nov 2005 13:54:05 -0000
@@ -1,5 +1,5 @@
 /* uuencode utility.
-   Copyright (C) 1994, 1995, 1996, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 2002, 2005 Free Software Foundation, Inc.
 
    This product is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -62,6 +62,15 @@
 #include "gettext.h"
 #define _(str) gettext (str)
 
+#if __CYGWIN__
+# include <fcntl.h>
+# include <io.h> /* for setmode */
+#endif
+
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
 /*=======================================================\
 | uuencode [INPUT] OUTPUT                               |
 |                                                       |
@@ -268,13 +277,18 @@ warranty; not even for MERCHANTABILITY o
 
       /* Optional first argument is input file.  */
 
-      if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb))
+      if (!freopen (argv[optind], O_BINARY ? "rb": "r", stdin)
+         || fstat (fileno (stdin), &sb))
        error (EXIT_FAILURE, errno, "%s", argv[optind]);
       mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
       optind++;
       break;
 
     case 1:
+#if __CYGWIN
+      if (! isatty (STDIN_FILENO))
+       setmode (STDIN_FILENO, O_BINARY);
+#endif
       mode = RW & ~umask (RW);
       break;
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]