| Anonymous | Login | Signup for a new account | 2010-02-09 12:33 UTC |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
| ID | Category | Severity | Type | Date Submitted | Last Update | |||||||
| 0000161 | [1003.1(2008)/Issue 7] Shell and Utilities | Objection | Error | 2009-10-03 23:17 | 2009-12-08 10:00 | |||||||
| Reporter | eblake | View Status | public | |||||||||
| Assigned To | ajosey | |||||||||||
| Priority | normal | Resolution | Accepted As Marked | |||||||||
| Status | Interpretation Required | |||||||||||
| Name | Eric Blake | |||||||||||
| Organization | N/A | |||||||||||
| User Reference | ebb.mkdir | |||||||||||
| Section | mkdir | |||||||||||
| Page Number | 2937 | |||||||||||
| Line Number | 96644 | |||||||||||
| Interp Status | Approved | |||||||||||
| Final Accepted Text | See Note: 0000247 | |||||||||||
| Summary | 0000161: mkdir -p through dangling symlink | |||||||||||
| Description |
The description of mkdir -p in terms of a shell script is incorrect in the presence of whitespace in the directory name. In particular, consider: mkdir -p "$(printf 'a b\n'/c')" which in practice creates the parent directory with a trailing newline, but which according to the spec effectively recursively calls mkdir(1) with two arguments and no newline, instead of a single argument. Furthermore, it seems inconsistent that: ln -s dir dangling mkdir -p dangling/sub is required to fail (since it recurses to 'mkdir -p dangling', but that must fail with EEXIST), while mkdir -p dangling/ is required to succeed (the recursion sees $(dirname dangling/) which is ".", and that exists; next the code has the same effect as mkdir("dangling/") which is required to follow through the symlink per mkdir(2)). (It doesn't help that GNU/Linux mkdir(2) fails with EEXIST when dealing with a symlink with trailing slash, in violation of the standard as written). Correctly describing the dirname operation in shell without losing a trailing newline gets rather lengthy. Providing a trailing slash to the recursive mkdir call solves the problem of stripping trailing newline. Furthermore, requiring a trailing slash on all intermediate components will give more predictable behavior, where a directory can be created through a dangling symlink. |
|||||||||||
| Desired Action |
Replace lines 96644-5: mkdir −p −m $(umask −S),u+wx $(dirname dir) && mkdir [−m mode] dir with: mkdir −p −m $(umask −S),u+wx \ "$(dirname "dir" | head -n -1; printf /)" && mkdir [−m mode] "dir" |
|||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
|
|
||||||||||||
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2009-10-03 23:17 | eblake | New Issue | |
| 2009-10-03 23:17 | eblake | Status | New => Under Review |
| 2009-10-03 23:17 | eblake | Assigned To | => ajosey |
| 2009-10-03 23:17 | eblake | Name | => Eric Blake |
| 2009-10-03 23:17 | eblake | Organization | => N/A |
| 2009-10-03 23:17 | eblake | User Reference | => ebb.mkdir |
| 2009-10-03 23:17 | eblake | Section | => mkdir |
| 2009-10-03 23:17 | eblake | Page Number | => 2937 |
| 2009-10-03 23:17 | eblake | Line Number | => 96644 |
| 2009-10-03 23:24 | eblake | Note Added: 0000245 | |
| 2009-10-03 23:38 | eblake | Note Added: 0000246 | |
| 2009-10-05 09:59 | geoffclare | Note Added: 0000247 | |
| 2009-10-05 10:00 | geoffclare | Note Edited: 0000247 | |
| 2009-10-05 10:01 | geoffclare | Note Edited: 0000247 | |
| 2009-10-08 16:22 | nick | Interp Status | => Pending |
| 2009-10-08 16:22 | nick | Final Accepted Text | => See Note: 0000247 |
| 2009-10-08 16:22 | nick | Note Added: 0000249 | |
| 2009-10-08 16:22 | nick | Status | Under Review => Interpretation Required |
| 2009-10-08 16:22 | nick | Resolution | Open => Accepted As Marked |
| 2009-10-08 16:26 | nick | Note Edited: 0000247 | |
| 2009-10-08 16:27 | nick | Note Deleted: 0000249 | |
| 2009-10-09 08:12 | geoffclare | Note Edited: 0000247 | |
| 2009-11-07 07:20 | ajosey | Interp Status | Pending => Proposed |
| 2009-12-08 10:00 | ajosey | Interp Status | Proposed => Approved |
| Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |