-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bash subshell file descriptors produce nothing #894
Comments
i checked and confirm ytt does not work that way in bash(GNU bash, version 5.2.15(1)-release (aarch64-apple-darwin22.1.0)) and zsh(zsh 5.9 (x86_64-apple-darwin23.0)). |
Thanks. Bash turns that expression into a valid file name. In other words, it is a valid file name. Every program which accepts a file name should work with the <( cmd ) syntax in bash or compatible shells. |
here https://github.com/carvel-dev/ytt/blob/develop/pkg/files/file.go#L273 I see an option to read from named pipe, so i think this is a bug. |
Thank you. I'm not 100% sure, but I think that changing The same should apply to the isSymLink line. |
The condition is correct. if namedpipe bit is set in fileinfo, its bitwise AND with namedpipemode should be non zero. |
also feel free to submit a PR if you figure out a fix. |
Of course you're correct. I had to do a double take on that one. I'm on another project now, but when I get back to the one which is relying on YTT, if it's not fixed yet, i'll submit a PR. |
TL,DR: The thing is, that the process substitution gives you a file name like But with the above shown approach you can give the thing a name, and thus a filename extension, which let's BTW: there's some sort of a special behavior when you have : echo 'foo: bar' | ytt -f /dev/stdin
: : echo 'foo: bar' | ytt -f -
foo: bar
: Some other maybe interesting bits: Same thing also happens with named pipes; e.g. when you do a The code comment suggests, that process substitution results in a pipe, however over here1 it actually results in a symlink to a pipe. I have to assume that e.g. on Darwin and others, process substitution might end up in being represented as a pipe (without symlink). "external symlinks" are not allowed by default, however symlinks to pipes in If that is true, that's a bit odd, because this would mean that You could also explicitly tell And lastly, I found So all in all, I think:
Footnotes
|
@hoegaarden Thank you for that thorough, and very useful response. Better documentation on pipes would help big time. For me, the problem is solved. I am convinced that I was wrong to view this as a bug. If everyone is in agreement, please feel free to close the ticket. |
@hoegaarden thanks for the detail explanation. But I am still bit unsure why the pipes are treated as plain files (without extension) whereas the stdin is treated as .yaml |
ok so I saw this in test now ytt/test/e2e/assets/test_pipe_redirect.sh Lines 5 to 6 in 6d2001d
|
What steps did you take:
[A clear and concise description steps and yaml files that can be used to reproduce the problem.]
ytt -f <(echo hello: world)
What happened:
[A small description of the result or the yaml that was generated]
Nothing was produced.
What did you expect:
[A description of what was expected and the yaml that should have been generated]
I expected:
Anything else you would like to add:
[Additional information that will assist in solving the issue.]
cat <(echo hello:world)
results inhello: world
as expected.Environment:
ytt --version
): ytt version 0.48.0/etc/os-release
): Darwin RichBook.local 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000 arm64Vote on this request
This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.
👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"
We are also happy to receive and review Pull Requests if you want to help working on this issue.
The text was updated successfully, but these errors were encountered: