ExpandFilename does not handle double DirectorySeparator followed by .. in a path
Original Reporter info from Mantis: Bart @flyingsheep
-
Reporter name: Bart Broersma
Original Reporter info from Mantis: Bart @flyingsheep
- Reporter name: Bart Broersma
Description:
ExpandFilename returns wrong result if path contains a double DirectorySeparator followed by ..
Steps to reproduce:
program expfn;
{$apptype console} //delphi 7 does not parse this if it is inside ifdef windows
{$ifdef fpc}
{mode objfpc}{
h+}
{$endif}
uses
sysutils;
begin
writeln('c:\devel\fpc\\..\ -> ',expandfilename('c:\devel\fpc\\..\'));
writeln('c:\devel\fpc\\.. -> ',expandfilename('c:\devel\fpc\\..'));
writeln('c:\devel\fpc\..\ -> ',expandfilename('c:\devel\fpc\..\'));
writeln('c:\devel\fpc\.. -> ',expandfilename('c:\devel\fpc\..'));
end.
C:\Users\Bart\LazarusProjecten\bugs\Console\expandfilename>fpc expfn.lpr
Free Pascal Compiler version 3.1.1 [2018/07/18] for i386
...
18 lines compiled, 0.2 sec, 69760 bytes code, 4196 bytes data
C:\Users\Bart\LazarusProjecten\bugs\Console\expandfilename>expfn
c:\devel\fpc\..\ -> C:\devel\fpc<br/>
c:\devel\fpc\.. -> C:\devel\fpc
c:\devel\fpc..\ -> C:\devel<br/>
c:\devel\fpc.. -> C:\devel
C:\Users\Bart\LazarusProjecten\bugs\Console\expandfilename>dcc32 expfn.lpr
Borland Delphi Version 15.0
...
20 lines, 0.02 seconds, 29600 bytes code, 2969 bytes data.
C:\Users\Bart\LazarusProjecten\bugs\Console\expandfilename>expfn
c:\devel\fpc\..\ -> c:\devel<br/>
c:\devel\fpc\.. -> c:\devel
c:\devel\fpc..\ -> c:\devel<br/>
c:\devel\fpc.. -> c:\devel
Additional information:
See forum discussion at http://forum.lazarus.freepascal.org/index.php/topic,42155.0.html
Reported there by user ASBzone.
Mantis conversion info:
- Mantis ID: 34166
- OS: Windows
- OS Build: 10
- Build: r39352
- Platform: i386
- Version: 3.1.1
- Fixed in version: 3.3.1
- Fixed in revision: 39840 (#62b57e81)