delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/04/15/16:02:52

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Mon, 15 Apr 2002 22:00:43 +0200
From: Pavel Tsekov <ptsekov AT gmx DOT net>
Reply-To: Pavel Tsekov <ptsekov AT gmx DOT net>
X-Priority: 3 (Normal)
Message-ID: <1653605153.20020415220043@gmx.net>
To: cygwin AT cygwin DOT com
Subject: [PATCH] cygutils:conv.c: Prevent truncation of file if 0xFF is encountered
MIME-Version: 1.0
Note-from-DJ: This may be spam

------------591441A613FBFE6A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello ;)

Today a colleague of mine was struck by a bug of dos2unix/unix2dos
utilities i.e. if the code encounters 0xFF in the file being processed
it erronously thinks that this is the EOF and stops processing. The
result is that the original file is truncated to the position of the
0xFF character.

As to why we have such characters in source file - our mother language
is bulgarian and we sometimes still type comments in it :)

A patch is attached to fix this behaviour.
------------591441A613FBFE6A
Content-Type: application/octet-stream; name="conv.c.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="conv.c.diff"

LS0tIGN5Z3V0aWxzLTEuMC4wL3NyYy9jb252L2NvbnYuYwlTdW4gTWFyICAzIDAzOjA5OjM5IDIw
MDIKKysrIC9ob21lL3BhdmVsdHovY29udi5jCU1vbiBBcHIgMTUgMTk6Mjg6MTYgMjAwMgpAQCAt
MzI2LDYgKzMyNiw3IEBAIHN0YXRpYyBpbnQgY29udmVydChjb25zdCBjaGFyICpmbiwgaW50IEMK
ICAgY2hhciAqdGVtcEZ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ewogICAgICAg
aWYgKGMgPT0gJ1xyJykKICAgICAgICAgY29udGludWU7CiAgICAgICBpZiAoYyA9PSAnXG4nKSB7
CkBAIC00MjQsNyArNDI3LDggQEAgc3RhdGljIGludCBjb252ZXJ0KGNvbnN0IGNoYXIgKmZuLCBp
bnQgQwogICAgICAgcmV0dXJuIC0yOwogICAgIH0KIAotICAgIHdoaWxlICgoYyA9IGZnZXRjKGlu
KSkgIT0gRU9GKQorICAgIHdoaWxlICgoYyA9IGZnZXRjKGluKSkgIT0gRU9GIHx8CisgICAgICAg
ICAgICEoZXJyb3IgPSAoZmVvZiAoaW4pICE9IDAgfHwgZmVycm9yKGluKSAhPSAwKSkpCiAgICAg
ICBmcHV0YyhjLCBvdXQpOwogCiAgICAgaWYgKGZjbG9zZShpbikgPCAwKSB7Cg==


------------591441A613FBFE6A
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
------------591441A613FBFE6A--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019