Skip to content

isfile error on too long file names #39774

Open
@GiggleLiu

Description

@GiggleLiu

The maximum filename length is 255, isfile should return false rather than raising an error when the file name is too long.

julia> isfile(randstring(256))
ERROR: IOError: stat("yDdEhZcxL943psM9mDEXZJhZwXH0cnrNCR8Ps1MrdDB8I8EDaN1WDyL40PQlcEra20zt1CyDOEv4cR7BlsIyJr0hBhoFl1kP2kQBJvTcdsTjVUx65g2kgCfER3adn3xQkIVA80mYfXvQBNBxNg9rLfsOh6TjGXApOLVRBBRBWsGc6dYwFRWZgDyRhkjNBecthZ7Pgg0EQFnLPRrlXpMdBaPoV0fDF8iNfhguOdfGpwjAD7U8ABJSW2fFUeHmUoMr"): name too long (ENAMETOOLONG)
Stacktrace:
 [1] uv_error
   @ ./libuv.jl:97 [inlined]
 [2] stat(path::String)
   @ Base.Filesystem ./stat.jl:69
 [3] isfile(path::String)
   @ Base.Filesystem ./stat.jl:311
 [4] top-level scope
   @ REPL[20]:1

The same applies for isdir

relevant code:

@eval ($f)(path...) = ($f)(stat(path...))

Julia version: 1.6.0-rc1

Metadata

Metadata

Assignees

Labels

docsThis change adds or pertains to documentationfilesystemUnderlying file system and functions that use it

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions