Greg Freemyer wrote:
On Fri, Aug 22, 2014 at 6:22 AM, Bernhard Voelker
wrote: On 08/21/2014 10:38 PM, Anton Aylward wrote:
Try
cat /tmp tr /tmp od -cb /tmp
Like dd these are all FILE operations. All give the same error: "Is a directory" That's what you get when you try running a file tool on a directory.
And that's the point: it's not a limitation in the tool - whatever the tool would do with such data - but rather a limit implied by the kernel. And the info page states this clearly:
`directory' Fail unless the file is a directory. Most operating systems do not allow I/O to a directory, so this flag has limited utility.
You can observe it with 'strace -v dd if=/tmp iflag=directory':
... open("/tmp", O_RDONLY|O_DIRECTORY) = 3 dup2(3, 0) = 0 close(3) = 0 lseek(0, 0, SEEK_CUR) = 0 ... read(0, 0x8e5000, 512) = -1 EISDIR (Is a directory)
If I remember correctly from +10 years ago, 'cat /some/dir' works on e.g. HP-UX, although the use is quite limited.
Have a nice day, Berny
Berny,
Why does dd have a flag option of nofollow? Why noatime?
I've never noticed either of them before this discussion, but they seem foreign to a tool like dd.
nofollow in particular seems crazy. If I don't want dd to work if "if" points at a symlink, then I shouldn't be calling dd on it in the first time.
As noatime, that's a great option for a tree walking backup tool, but why in world does it make sense for dd.
The above plus the "directory" flag make me think that ther is a use case for dd that I've never considered let alone used.
Something like a shell script that can walk a directory tree and call dd on each of the files in order to create a backup copy. I can conceive of that but the problems of metadata data handling and non-files (eg. devices, sockets, symlinks, etc) seem to overwhelm the use case.
My argument is that without an legitimate elucidation of the use case for "directory", "nofollow", and "noatime" they should be removed from dd and from the documentation for dd.
They make it easier to write shell scripts that call dd within some sort of tree-walker such as find(1) to do exactly what the author of the shell-script wants it to do.
Greg
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org