Project

General

Profile

Actions

Feature #5974

closed

Access PC_NAME_MAX and PC_PATH_MAX values

Added by tenderlovemaking (Aaron Patterson) about 12 years ago. Updated about 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:42374]

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

max_path.patch (2.49 KB) max_path.patch tenderlovemaking (Aaron Patterson), 02/07/2012 04:16 AM

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0