Opened 16 years ago

Closed 5 years ago

Last modified 4 years ago

#2642 closed bug (fixed)

bfs: mkdir creates invalid directory

Reported by: emitrax Owned by: nobody
Priority: low Milestone: R1/beta2
Component: System/POSIX Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
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 (9)

comment:1 by axeld, 16 years ago

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?

in reply to:  1 comment:2 by emitrax, 16 years ago

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 by scottmc, 13 years ago

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 by pulkomandy, 9 years ago

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 by axeld, 9 years ago

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 by axeld, 7 years ago

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

comment:7 by waddlesplash, 5 years ago

Milestone: R1Unscheduled

comment:8 by waddlesplash, 5 years ago

Resolution: fixed
Status: assignedclosed

Fixed in hrev52783.

comment:9 by nielx, 4 years ago

Milestone: UnscheduledR1/beta2

Assign tickets with status=closed and resolution=fixed within the R1/beta2 development window to the R1/beta2 Milestone

Note: See TracTickets for help on using tickets.