How does cd's “-@” parameter work?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












2















bash's man page (and help cd) mentions that cd supports a -@ parameter ("on systems that support it") to "present a file with extended attributes as a directory containing the file attributes"



Is there an example of using this? (Ideally with a commonly present file, or with a setup to create an example (I'm not familiar enough with xattr currnelt))



Where is it supported? Everywhere supporting xattrs, or is there more kernel support needed? (i.e. Can I use it with an xattr-supporting version of OS X, Solaris, FreeBSD, Linux, etc)



My guess is that if a file, /path/f has xattrs I can do cd -@ /path/f and ls would then show xattrs as (emulated) "files" in the emulated "directory" /path/f? (For this, I assume that the kernel need some kind of support for this simulation, since things like ls live outside bash, which means that bash can't be doing the emulation)










share|improve this question






















  • Related: Examples of options to bash cd, eg: cd -Pe@ $directory.

    – Stephen Kitt
    Feb 27 at 8:21











  • I tried setfattr on WSL and get setfattr: test: Operation not supported, so I'm assuming I need to try a real Linux to see if I can create an xattr on a file for my own testing... (A random XFS and ext4 filesystem gets the same result with the default mount options) (I know OS X makes extended use of xattrs, so it might be testable there)

    – Gert van den Berg
    Feb 27 at 8:29











  • @StephenKitt Useful, but no info on -@ beyond the man page or help output there either...

    – Gert van den Berg
    Feb 27 at 8:31















2















bash's man page (and help cd) mentions that cd supports a -@ parameter ("on systems that support it") to "present a file with extended attributes as a directory containing the file attributes"



Is there an example of using this? (Ideally with a commonly present file, or with a setup to create an example (I'm not familiar enough with xattr currnelt))



Where is it supported? Everywhere supporting xattrs, or is there more kernel support needed? (i.e. Can I use it with an xattr-supporting version of OS X, Solaris, FreeBSD, Linux, etc)



My guess is that if a file, /path/f has xattrs I can do cd -@ /path/f and ls would then show xattrs as (emulated) "files" in the emulated "directory" /path/f? (For this, I assume that the kernel need some kind of support for this simulation, since things like ls live outside bash, which means that bash can't be doing the emulation)










share|improve this question






















  • Related: Examples of options to bash cd, eg: cd -Pe@ $directory.

    – Stephen Kitt
    Feb 27 at 8:21











  • I tried setfattr on WSL and get setfattr: test: Operation not supported, so I'm assuming I need to try a real Linux to see if I can create an xattr on a file for my own testing... (A random XFS and ext4 filesystem gets the same result with the default mount options) (I know OS X makes extended use of xattrs, so it might be testable there)

    – Gert van den Berg
    Feb 27 at 8:29











  • @StephenKitt Useful, but no info on -@ beyond the man page or help output there either...

    – Gert van den Berg
    Feb 27 at 8:31













2












2








2








bash's man page (and help cd) mentions that cd supports a -@ parameter ("on systems that support it") to "present a file with extended attributes as a directory containing the file attributes"



Is there an example of using this? (Ideally with a commonly present file, or with a setup to create an example (I'm not familiar enough with xattr currnelt))



Where is it supported? Everywhere supporting xattrs, or is there more kernel support needed? (i.e. Can I use it with an xattr-supporting version of OS X, Solaris, FreeBSD, Linux, etc)



My guess is that if a file, /path/f has xattrs I can do cd -@ /path/f and ls would then show xattrs as (emulated) "files" in the emulated "directory" /path/f? (For this, I assume that the kernel need some kind of support for this simulation, since things like ls live outside bash, which means that bash can't be doing the emulation)










share|improve this question














bash's man page (and help cd) mentions that cd supports a -@ parameter ("on systems that support it") to "present a file with extended attributes as a directory containing the file attributes"



Is there an example of using this? (Ideally with a commonly present file, or with a setup to create an example (I'm not familiar enough with xattr currnelt))



Where is it supported? Everywhere supporting xattrs, or is there more kernel support needed? (i.e. Can I use it with an xattr-supporting version of OS X, Solaris, FreeBSD, Linux, etc)



My guess is that if a file, /path/f has xattrs I can do cd -@ /path/f and ls would then show xattrs as (emulated) "files" in the emulated "directory" /path/f? (For this, I assume that the kernel need some kind of support for this simulation, since things like ls live outside bash, which means that bash can't be doing the emulation)







bash cd-command xattr






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 27 at 8:15









Gert van den BergGert van den Berg

1,045616




1,045616












  • Related: Examples of options to bash cd, eg: cd -Pe@ $directory.

    – Stephen Kitt
    Feb 27 at 8:21











  • I tried setfattr on WSL and get setfattr: test: Operation not supported, so I'm assuming I need to try a real Linux to see if I can create an xattr on a file for my own testing... (A random XFS and ext4 filesystem gets the same result with the default mount options) (I know OS X makes extended use of xattrs, so it might be testable there)

    – Gert van den Berg
    Feb 27 at 8:29











  • @StephenKitt Useful, but no info on -@ beyond the man page or help output there either...

    – Gert van den Berg
    Feb 27 at 8:31

















  • Related: Examples of options to bash cd, eg: cd -Pe@ $directory.

    – Stephen Kitt
    Feb 27 at 8:21











  • I tried setfattr on WSL and get setfattr: test: Operation not supported, so I'm assuming I need to try a real Linux to see if I can create an xattr on a file for my own testing... (A random XFS and ext4 filesystem gets the same result with the default mount options) (I know OS X makes extended use of xattrs, so it might be testable there)

    – Gert van den Berg
    Feb 27 at 8:29











  • @StephenKitt Useful, but no info on -@ beyond the man page or help output there either...

    – Gert van den Berg
    Feb 27 at 8:31
















Related: Examples of options to bash cd, eg: cd -Pe@ $directory.

– Stephen Kitt
Feb 27 at 8:21





Related: Examples of options to bash cd, eg: cd -Pe@ $directory.

– Stephen Kitt
Feb 27 at 8:21













I tried setfattr on WSL and get setfattr: test: Operation not supported, so I'm assuming I need to try a real Linux to see if I can create an xattr on a file for my own testing... (A random XFS and ext4 filesystem gets the same result with the default mount options) (I know OS X makes extended use of xattrs, so it might be testable there)

– Gert van den Berg
Feb 27 at 8:29





I tried setfattr on WSL and get setfattr: test: Operation not supported, so I'm assuming I need to try a real Linux to see if I can create an xattr on a file for my own testing... (A random XFS and ext4 filesystem gets the same result with the default mount options) (I know OS X makes extended use of xattrs, so it might be testable there)

– Gert van den Berg
Feb 27 at 8:29













@StephenKitt Useful, but no info on -@ beyond the man page or help output there either...

– Gert van den Berg
Feb 27 at 8:31





@StephenKitt Useful, but no info on -@ beyond the man page or help output there either...

– Gert van den Berg
Feb 27 at 8:31










1 Answer
1






active

oldest

votes


















3














I think -@ is only supported on Solaris (and systems based on Solaris, such as Illumos). On Solaris, extended attributes can be considered as files in an orthogonal name space; in theory, any file (in the general sense, including directories etc.) can have extended attributes, which themselves can have extended attributes, etc. In order to explore this forest of attributes, there are APIs which allow them to be handled as a tree of files, and this is what cd -@ uses (and -@ on other commands). See fsattr(5) for details. This can be limited depending on the supporting file system; for example UFS doesn’t allow directories to be used as attributes, and doesn’t allow attributes to have attributes themselves.



On Solaris, the way this appears to the user is as you suggest:



~$ touch test
~$ cd -@ test
/proc/1604/fd/6$ ls
SUNWattr_ro SUNWattr_rw
/proc/1604/fd/6$ touch attribute


This creates an “attribute” extended attribute file attached to the “test” file. cd -@ attribute works too, inside the attribute tree, and one can continue down the rabbit hole.



A similar extended attribute API was floated recently (January 2019) for Linux, notably as part of a discussion on fs-verity.






share|improve this answer

























  • Ah, I didin't realise that extended attributes differ that significantly between *nixes... (Other than to a "not enabled" or "not supported" level)

    – Gert van den Berg
    Feb 27 at 8:37










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f503271%2fhow-does-cds-parameter-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














I think -@ is only supported on Solaris (and systems based on Solaris, such as Illumos). On Solaris, extended attributes can be considered as files in an orthogonal name space; in theory, any file (in the general sense, including directories etc.) can have extended attributes, which themselves can have extended attributes, etc. In order to explore this forest of attributes, there are APIs which allow them to be handled as a tree of files, and this is what cd -@ uses (and -@ on other commands). See fsattr(5) for details. This can be limited depending on the supporting file system; for example UFS doesn’t allow directories to be used as attributes, and doesn’t allow attributes to have attributes themselves.



On Solaris, the way this appears to the user is as you suggest:



~$ touch test
~$ cd -@ test
/proc/1604/fd/6$ ls
SUNWattr_ro SUNWattr_rw
/proc/1604/fd/6$ touch attribute


This creates an “attribute” extended attribute file attached to the “test” file. cd -@ attribute works too, inside the attribute tree, and one can continue down the rabbit hole.



A similar extended attribute API was floated recently (January 2019) for Linux, notably as part of a discussion on fs-verity.






share|improve this answer

























  • Ah, I didin't realise that extended attributes differ that significantly between *nixes... (Other than to a "not enabled" or "not supported" level)

    – Gert van den Berg
    Feb 27 at 8:37















3














I think -@ is only supported on Solaris (and systems based on Solaris, such as Illumos). On Solaris, extended attributes can be considered as files in an orthogonal name space; in theory, any file (in the general sense, including directories etc.) can have extended attributes, which themselves can have extended attributes, etc. In order to explore this forest of attributes, there are APIs which allow them to be handled as a tree of files, and this is what cd -@ uses (and -@ on other commands). See fsattr(5) for details. This can be limited depending on the supporting file system; for example UFS doesn’t allow directories to be used as attributes, and doesn’t allow attributes to have attributes themselves.



On Solaris, the way this appears to the user is as you suggest:



~$ touch test
~$ cd -@ test
/proc/1604/fd/6$ ls
SUNWattr_ro SUNWattr_rw
/proc/1604/fd/6$ touch attribute


This creates an “attribute” extended attribute file attached to the “test” file. cd -@ attribute works too, inside the attribute tree, and one can continue down the rabbit hole.



A similar extended attribute API was floated recently (January 2019) for Linux, notably as part of a discussion on fs-verity.






share|improve this answer

























  • Ah, I didin't realise that extended attributes differ that significantly between *nixes... (Other than to a "not enabled" or "not supported" level)

    – Gert van den Berg
    Feb 27 at 8:37













3












3








3







I think -@ is only supported on Solaris (and systems based on Solaris, such as Illumos). On Solaris, extended attributes can be considered as files in an orthogonal name space; in theory, any file (in the general sense, including directories etc.) can have extended attributes, which themselves can have extended attributes, etc. In order to explore this forest of attributes, there are APIs which allow them to be handled as a tree of files, and this is what cd -@ uses (and -@ on other commands). See fsattr(5) for details. This can be limited depending on the supporting file system; for example UFS doesn’t allow directories to be used as attributes, and doesn’t allow attributes to have attributes themselves.



On Solaris, the way this appears to the user is as you suggest:



~$ touch test
~$ cd -@ test
/proc/1604/fd/6$ ls
SUNWattr_ro SUNWattr_rw
/proc/1604/fd/6$ touch attribute


This creates an “attribute” extended attribute file attached to the “test” file. cd -@ attribute works too, inside the attribute tree, and one can continue down the rabbit hole.



A similar extended attribute API was floated recently (January 2019) for Linux, notably as part of a discussion on fs-verity.






share|improve this answer















I think -@ is only supported on Solaris (and systems based on Solaris, such as Illumos). On Solaris, extended attributes can be considered as files in an orthogonal name space; in theory, any file (in the general sense, including directories etc.) can have extended attributes, which themselves can have extended attributes, etc. In order to explore this forest of attributes, there are APIs which allow them to be handled as a tree of files, and this is what cd -@ uses (and -@ on other commands). See fsattr(5) for details. This can be limited depending on the supporting file system; for example UFS doesn’t allow directories to be used as attributes, and doesn’t allow attributes to have attributes themselves.



On Solaris, the way this appears to the user is as you suggest:



~$ touch test
~$ cd -@ test
/proc/1604/fd/6$ ls
SUNWattr_ro SUNWattr_rw
/proc/1604/fd/6$ touch attribute


This creates an “attribute” extended attribute file attached to the “test” file. cd -@ attribute works too, inside the attribute tree, and one can continue down the rabbit hole.



A similar extended attribute API was floated recently (January 2019) for Linux, notably as part of a discussion on fs-verity.







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 27 at 9:40

























answered Feb 27 at 8:31









Stephen KittStephen Kitt

177k24402480




177k24402480












  • Ah, I didin't realise that extended attributes differ that significantly between *nixes... (Other than to a "not enabled" or "not supported" level)

    – Gert van den Berg
    Feb 27 at 8:37

















  • Ah, I didin't realise that extended attributes differ that significantly between *nixes... (Other than to a "not enabled" or "not supported" level)

    – Gert van den Berg
    Feb 27 at 8:37
















Ah, I didin't realise that extended attributes differ that significantly between *nixes... (Other than to a "not enabled" or "not supported" level)

– Gert van den Berg
Feb 27 at 8:37





Ah, I didin't realise that extended attributes differ that significantly between *nixes... (Other than to a "not enabled" or "not supported" level)

– Gert van den Berg
Feb 27 at 8:37

















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f503271%2fhow-does-cds-parameter-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay