X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX1+JjMpnXMOJDAxemihoduLXtB53Fdfz2qFAnRMyzS OhSRXaAnZtZdkV Message-ID: <5180E8C7.4010609@gmx.de> Date: Wed, 01 May 2013 12:04:55 +0200 From: Juan Manuel Guerrero User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2 MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: The encoding of S_IFREG Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Reply-To: djgpp-workers AT delorie DOT com While I was trying to port patch 2.7.1, besides a lot of issues, I encountered the following problem: DJGPP file mode encodes S_IFREG with 0x0000. Unfortunately the patch code checks if the file mode is valid at all by checking against zero. This means that if the file mode extracted from the diff file (for git style patches) or the file mode returned by the stat structure is zero it aborts. Of course, I have fixed this by also checking with S_ISREG so I can avoid the program stop or erratic behaviour. An inspection of my linux stat.h shows that no valid combination of S_IF* bits will ever lead to a file mode identical to zero. Is there any particular reason why DJGPP does encode S_IFREG with zero? Are there any objections if this is changed? Currently the following encodings are used: #define S_IFMT 0xf000 #define S_IFREG 0x0000 #define S_IFBLK 0x1000 #define S_IFCHR 0x2000 #define S_IFDIR 0x3000 #define S_IFIFO 0x4000 #define S_IFLNK 0x8000 #define S_IFLABEL 0x5000 We could replace 0x0000 by 0x6000. I am aware that this may introduce backward incompatibilities, but I think that nowadays the group of DJGPP users is so vanishing that this change will not really harm some one. But the benefits when a porting job is done are evident. Regards, Juan M. Guerrero