Feature #5974
closedAccess PC_NAME_MAX and PC_PATH_MAX values
Description
Hi,
In order to construct file names that don't raise Errno::ENAMETOOLONG, I'd like to be able to access PC_NAME_MAX and PC_PATH_MAX from pathconf given a particular directory object.
I've attached a patch which exposes both of these values on a Dir object.
Files
Updated by kosaki (Motohiro KOSAKI) about 12 years ago
Hi,
In order to construct file names that don't raise Errno::ENAMETOOLONG, I'd like to be able to access PC_NAME_MAX and PC_PATH_MAX from pathconf given a particular directory object.
I've attached a patch which exposes both of these values on a Dir object.
Hmm...
I don't think it's useful. why? fpatchconf() doesn't have an enough
portable and reliable meanings. example, fpathconf(PC_PATH_MAX) on
linux glibc always return PATH_MAX (=4096). but some linux filesystems
can only treat 256 bytes path length. Therefore, even if you properly
checked path length, you still might get
path length related error from syscalls.
I'm afraid this method bring rubyist a misunderstand.
Updated by tenderlovemaking (Aaron Patterson) about 12 years ago
- Status changed from Open to Rejected
Ugh. I didn't know that is the behavior on linux. I agree this would cause confusion, so I will just close it. Thanks for reading!
Updated by naruse (Yui NARUSE) about 12 years ago
The portable way to check the too long filename is just make a file and catch Errno::ENAMETOOLONG.
Unix has many related constants and functions but they are useless.