View Issue Details

IDProjectCategoryView StatusLast Update
0036892FPCRTLpublic2020-04-09 23:06
ReporterBill Stewart Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.0.4 
Fixed in Version3.3.1 
Summary0036892: getopts - OptArg length limit is 255 characters (shortstring)
DescriptionOptArg (option argument variable) is shortstring and limited to 255 characters.
Steps To ReproduceRun below program and specify -a option with an argument that has length > 255 characters. Program outputs "OptArg length = 255".

{$MODE OBJFPC}
{$H+}

program test_getopts;

uses
  getopts;

var
  opt: char;

begin
  repeat
    opt := GetOpt('a:');
    if opt = 'a' then
      WriteLn('OptArg length = ', Length(OptArg));
  until opt = EndOfOptions;
end.
TagsNo tags attached.
Fixed in Revision44664
FPCOldBugId
FPCTarget4.0.0
Attached Files

Activities

Michael Van Canneyt

2020-04-09 17:33

administrator   ~0122048

This unit is compiled in FPC mode, so string is a shortstring and has a limit of 255 chars.

I'll see if I can compile it with string=ansistring.

Bill Stewart

2020-04-09 21:30

reporter   ~0122051

Thank you - I didn't know if it was that simple or if there were other implications.

Michael Van Canneyt

2020-04-09 23:06

administrator   ~0122052

Fixed, thanks for reporting !

Issue History

Date Modified Username Field Change
2020-04-09 17:24 Bill Stewart New Issue
2020-04-09 17:32 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-04-09 17:32 Michael Van Canneyt Status new => assigned
2020-04-09 17:33 Michael Van Canneyt Note Added: 0122048
2020-04-09 21:30 Bill Stewart Note Added: 0122051
2020-04-09 23:06 Michael Van Canneyt Status assigned => resolved
2020-04-09 23:06 Michael Van Canneyt Resolution open => fixed
2020-04-09 23:06 Michael Van Canneyt Fixed in Version => 3.3.1
2020-04-09 23:06 Michael Van Canneyt Fixed in Revision => 44664
2020-04-09 23:06 Michael Van Canneyt FPCTarget => 4.0.0
2020-04-09 23:06 Michael Van Canneyt Note Added: 0122052