[fpc-pascal] ExpandFileName failure on long filenames on Linux

Tomas Hajny XHajT03 at hajny.biz
Sat Aug 31 15:54:34 CEST 2013


On Sat, August 31, 2013 15:24, Michael Van Canneyt wrote:
> On Sat, 31 Aug 2013, Bart wrote:


Hi,

>> Before reporting this as a bug, can somebody confirm?
>>
>> program efn;
>>
>> uses sysutils;
>>
>> begin
>>  writeln(expandfilename(paramstr(1)));
>> end.
>>
>> If I cd to a directory with a very long name (>255 chars) and then
>> exeucte the following:
>> $ ~/LazarusProjecten/bugs/findfirst/efn .
>>
>> It prints out only the first 255 characters of the current directory.
>> (This issue poped up whilst investigating
>> http://bugs.freepascal.org/view.php?id=24885)
>
> Did you enable ansistrings and object pascal mode ?
> Because as it is displayed above, the program will use shortstrings, and
> they are limited to 255 chars.

Well, I'm not sure if enabling ansistrings during program compilation
changes anything, nor that the issue is related to ExpandFileName, because
I believe that ParamStr (as provided in unit System) always returns
shortstring values. Using "argv [1]" instead of ParamStr (1) should
probably provide the expected result. I can imagine that we might add
ansistring overloaded version (or unicodestring overloaded version in
trunk).

Tomas





More information about the fpc-pascal mailing list