X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com Message-ID: <5B006738.1020806@gmx.de> Date: Sat, 19 May 2018 20:04:40 +0200 From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp-workers AT delorie DOT com]" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7 MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: DJGPP on NTF with SFN creating disabled [was : gcc-8.1.0 packages for testing] References: <0244cff9-6176-8aec-bbc2-6fc49602c295 AT iki DOT fi> <558b5ff2-71df-e556-a874-7acbb264c84a AT iki DOT fi> <5AED9B44 DOT 90000 AT gmx DOT de> <5AEF5D3A DOT 2030409 AT gmx DOT de> <3569b441-e678-7252-ffdd-7c45f72a5c56 AT iki DOT fi> <5AFDE635 DOT 9030405 AT gmx DOT de> In-Reply-To: <5AFDE635.9030405@gmx.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:i6EjZwayuhMMMAIaGiSyugGvI7jr10lSaExq/PIu7XtiYGJ5FOi Cwfhb9Vn35iMmmKN0O6k7uV4tWtk+NPzgppn5MB3Gi+ZQWkqnl5ody7UKIkq5fysfJSFuiS TVcrU8MTrEht8wyFUiEFYryYmc0ydZtOh5I8xFaGCCRcXltpgFdt2SJ28/y8mFJ5j3KANyn Dbqx4uc+Iorb20rdYZqsw== X-UI-Out-Filterresults: notjunk:1;V01:K0:YvqWkc9492I=:CprgXmZn+anQ6Pdtmwyx6Q NJ0EbZIrvnsiUH4jZmbhhUXrt9ZKulKsA5b+QlEnAIqoRt+XvfAfMtBstbEwn9TvYMMd4CUrS 5OMmp49FiivSkrB+p9Jhob/oMYb2zfKPFbpmk4eWN1WJemsQdhlmJJ11LnUQqglvBTEsoB+Rv x1bESFdJgtfNk1rxppaEhDUct7KW9IOEJDp/+TX18tMEUIsefAgYH6jcEIlL2VVVxjK9aa3Em 8CmKEm2y8bWhVs/hUQ0OOIuVPlNbBCuuhE1JKvYGAThaH+XIeGXulzUnewUWvKyuEiW169+6Q pJhbqP3uuwijDieeqN47pPfpQeC0Ccgxev9ANmr9WTvf/lSO0qMM5qFraQ9edEHRIuhCoXYH1 rMU8y9xI6YBicIYEW2F/QqReHZ+IbROJPuYHjx1635KzoDO+W01iH9hykSI/EBHU20RtE6lZC zHbb1tdfvRhzWWz009AHpL1KysFV182Vc0i/qyMOk99YMKA6Y9UkhU7Mt9AocPhZiRPMXhxR8 I94Yw6xxmsJaR/3tXbCrILhcmCwAcjJb8Mk+cq3lxP3dYDmsrULdH7JbuapqWUh3uWtSUtYip 2GDxFDbE7D4GfHwXHpKWJCIPVdx5+Q1jbCI7KcKlbJmQv37CeNrToBvj6hIn5tv0Nc4xdW8CN Hu3Zb2q82hep0miHZA/SBofXS34qVjbqImtkL4XhevP6pS5QQOa9s5McYhcjGnrhNB5q4MLrX oH0MQ4u8+jW0YS8ioCXl622uqptDp0LI4VnG4L6p9kxelbFaMG8Dph5VPfJ5jXUqKYh3X21JU XvnBoBK Reply-To: djgpp-workers AT delorie DOT com OFYI, I have commited the patch below. The bottom line of all this is that for the operating systems inspected by me, if the OS does not create a SFN alias then the only valid LFN is a SFN. A SFN has to be understood as a valid MSDOS file name. Regards, Juan M. Guerrero Index: djgpp/src/docs/kb/wc206.txi =================================================================== RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc206.txi,v retrieving revision 1.11 diff -p -U 5 -r1.11 wc206.txi --- djgpp/src/docs/kb/wc206.txi 2 Feb 2018 20:00:05 -0000 1.11 +++ djgpp/src/docs/kb/wc206.txi 19 May 2018 14:26:09 -0000 @@ -53,5 +53,10 @@ The low-level @code{_put_path} procedure [/\\]dev[/\\] instead of only /dev/ in file names. @cindex Compatibility with new gcc versions Compatibility with gcc-6 and newer versions achieved by using proper @option{-fno-builtin-*} compiler flags where needed in library builds. + +@findex open AT r{, and failure on file systems without SFN alias} +@code{open} will no longer fail when trying to open a file that has no +short file name alias. This used to happen for the NTFS and the exFAT +file systems. Index: djgpp/src/libc/dos/io/_open.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_open.c,v retrieving revision 1.12 diff -p -U 5 -r1.12 _open.c --- djgpp/src/libc/dos/io/_open.c 12 Mar 2014 22:58:31 -0000 1.12 +++ djgpp/src/libc/dos/io/_open.c 19 May 2018 14:26:09 -0000 @@ -1,13 +1,15 @@ +/* Copyright (C) 2018 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2014 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include #include +#include #include #include #include #include #include @@ -21,10 +23,11 @@ int _open(const char* filename, int oflag) { __dpmi_regs r; int rv; int use_lfn = _USE_LFN; + bool retry_with_lfn = false; if (filename == 0) { errno = EINVAL; return -1; @@ -48,10 +51,11 @@ _open(const char* filename, int oflag) r.x.es = __tb_segment; r.x.di = __tb_offset + _put_path(filename); /* Short name destination */ __dpmi_int(0x21, &r); if (!(r.x.flags & 1)) /* Get short name success */ { + retry_with_lfn = true; r.x.ax = 0x6c00; r.x.bx = (oflag & 0xff); r.x.dx = 1; /* Open existing file */ r.x.si = r.x.di; goto do_open; @@ -81,10 +85,11 @@ _open(const char* filename, int oflag) Permission? Readonly file? We should quit. Let it fall through to the LFN open which should succeed. */ } } } +fallback: if (use_lfn) { r.x.flags = 1; /* Always set CF before calling a 0x71NN function. */ r.x.ax = 0x716c; r.x.bx = (oflag & 0xff); @@ -134,10 +139,19 @@ do_open: r.x.dx = __tb_offset; goto do_open; } else if (r.x.flags & 1) { + if ((r.x.ax == 2 || r.x.ax == 3) && retry_with_lfn) + { + /* On partitions like NTFS and exFAT, files and paths with long names + do not have 8.3 aliases. If an attempt to open the file with short + name failed with "file not found" or "path not found", retry with + the LFN API. */ + retry_with_lfn = false; + goto fallback; + } errno = __doserr_to_errno(r.x.ax); return -1; } do_hset: __file_handle_set(r.x.ax, O_BINARY);