Opened 11 years ago

Closed 4 months ago

#2642 closed bug (fixed)

bfs: mkdir creates invalid directory

Reported by: emitrax Owned by: nobody
Priority: low Milestone: Unscheduled
Component: System/POSIX Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

Sorry, I couldn't find a better summary

for i in `seq -w 1 1000` ; do mkdir $i ; cd $i ; done

By running the above in bash, you'll see that onced reached the absolute deepth of 204 levels, the script continues to create directory in the last level, but it is unable to cd'in, and returns an error of "no such file or directory".

While not critical, it shouldn't create invalid directory.

Change History (8)

comment:1 Changed 11 years ago by axeld

This sounds very much like you get beyond B_PATH_NAME_LENGTH; it will cut the path after 1024 bytes, and therefore isn't able to create the directory with the name you intended.

What exactly happens? Have you tried to manually enter the deepest level to see how it looks like?

comment:2 in reply to:  1 Changed 11 years ago by emitrax

Replying to axeld:

This sounds very much like you get beyond B_PATH_NAME_LENGTH; it will cut the path after 1024 bytes, and therefore isn't able to create the directory with the name you intended.

If so, it should be handled differently, as in linux I get an path name too long or alike.

What exactly happens? Have you tried to manually enter the deepest level to see how it looks like?

Yes I did. I get a no such file or directory.

Actually, now that I think of, it shoulnd't be the B_PATH_NAME_LENGHT, because I always use the relative path, not the absolute. With the script, I create the directory and cd'in right away, then create another one, cd'in and so on. Thus the name is at most always 4 bytes.

comment:3 Changed 8 years ago by scottmc

Running this on hrev38581 I get this now about 204 levels deep:

cd: error retrieving current directory: getcwd: cannot access parent directories: Range Error

And "cd .." gives the same error message.

comment:4 Changed 4 years ago by pulkomandy

Component: - GeneralSystem/POSIX

There is still the error message scott gets, but there is no actual limitation now. It's just bash and cd getting lost at what the current directory is. You can check in tracker (with some patience) that the 1000 nested dirs were created just fine.

I tested the same on Linux and there is no such error (I interrupted the script after it created about 650 levels).

So there may be a problem in either bash or getcwd, but not in BFS.

comment:5 Changed 4 years ago by axeld

As I mentioned before, the B_PATH_NAME_LENGTH limit is likely to come into play at some point (for example, while trying to get the pwd for the prompt). It might be larger on your Linux test installation, anyway.

The error from getcwd also hints in that direction.

comment:6 Changed 2 years ago by axeld

Owner: changed from axeld to nobody
Priority: normallow
Status: newassigned

comment:7 Changed 7 months ago by waddlesplash

Milestone: R1Unscheduled

comment:8 Changed 4 months ago by waddlesplash

Resolution: fixed
Status: assignedclosed

Fixed in hrev52783.

Note: See TracTickets for help on using tickets.