|Anonymous | Login||2019-12-10 07:38 UTC|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details|
|ID||Category||Severity||Type||Date Submitted||Last Update|
|0001303||[1003.1(2016)/Issue7+TC2] System Interfaces||Comment||Enhancement Request||2019-11-27 05:11||2019-11-27 10:13|
|Section||alphasort, scandir, seekdir, telldir|
|Final Accepted Text|
|Summary||0001303: Artificial limit on the number of files in a directory.|
The scandir function returns the number of selected files in type ``int'', which is can be as short as 32 bits,
The seekdir and telldir functions works with directory position of type ``long'', which can be as short as 32 bits in some systems, and 64 bits in I32LP64 environments.
These facts creates artificial limits on the number of files that can be uniquely identified in these functions, although doesn't limit the actual number of file entries that can be stored and enumerated in a directory.
Although, in reality, actual filesystems may have more strict limits on the number of entries in a directory.
|Desired Action||None, but future revisions of the standard may wish to introduce improved interfaces that possibly works with the ``off_t'' type.|
|Tags||No tags attached.|
Since the scandir interface returns its result array via malloc's, size_t is a more appropriate type than off_t to ensure the result range is adequate. Similar applies with telldir() and seekdir() when the implementation uses record counts rather than a byte oriented file position to track entries.
In looking over the interface descriptions there is an issue with scandir(), in that it is not explicit for any error, especially that occurs after sel returns a match, that it is the responsibility of the interface to free any successfully allocated result strings and the memory for the array of string pointers, before returning -1 to indicate the traverse could not be completed. In low free memory conditions ENOMEM due to trying to allocate one of these is likely to occur.
scandir() is an interface from the past that had more issues in the past already.
Original implementations have e.g. been written with the directory entry size of UFS in mind and failed with filesystems that do not follow these "rules".
How about scandiro() like ftello()?
|2019-11-27 05:11||dannyniu||New Issue|
|2019-11-27 05:11||dannyniu||Name||=> DannyNiu/NJF|
|2019-11-27 05:11||dannyniu||Organization||=> individual|
|2019-11-27 05:11||dannyniu||Section||=> alphasort, scandir, seekdir, telldir|
|2019-11-27 05:11||dannyniu||Page Number||=> 597,1843,2141|
|2019-11-27 05:11||dannyniu||Line Number||=> 20774-20778,59725,68610|
|2019-11-27 06:11||shware_systems||Note Added: 0004667|
|2019-11-27 10:13||joerg||Note Added: 0004668|
|Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group|