kubernetes / website

Kubernetes website and documentation repo:
https://kubernetes.io
Creative Commons Attribution 4.0 International
4.37k stars 14.15k forks source link

Issue in copy-pasting snippets in terminal having comments #44866

Open erikh opened 6 months ago

erikh commented 6 months ago

In the docs, the following segment is in a section of code:

# If the folder `/etc/apt/keyrings` does not exist, it should be created before the curl command, read the note below.
# sudo mkdir -p -m 755 /etc/apt/keyrings
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg

If pasted in some shells (notably, zsh), where # is not a comment character at the beginning of the line, /etc/apt/keyrings is executed in a shell due to the backticks. It does nothing of course, but kind of sent my brain for a loop for a second.

Given that OS X shells these days are defaulted to zsh, seems like something worthy of concern to avoid in the future, as I could easily see others embedding actual commands in the comments which would get executed.

That said, thank you for maintaining such a wonderful resource, and have a good day.

k8s-ci-robot commented 6 months ago

This issue is currently awaiting triage.

SIG Docs takes a lead on issue triage for this website, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
dipesh-rawat commented 6 months ago

Page reported in issue (based on the issue title): https://kubernetes.io/docs/tasks/tools/install-kubectl-linux /language en

adityasamant25 commented 6 months ago

Hi @erikh , What could be an option? Perhaps to move the comment lines outside the code block?

Also a side note, This style of combining comments with the command to be executed within a block is seen at multiple pages throughout the site. So the issue being raised is not local to this page.

erikh commented 6 months ago

Well, I think the ideal option would be to include the comments but use another method of describing commands and literal locations. That said, I cannot think of a "better" syntax for this that doesn't really create the same problem.

Perhaps that is the best approach, or at least don't make it part of the copied content. Is that a sensible approach?

On Tuesday, January 23rd, 2024 at 8:37 PM, adityasamant25 @.***> wrote:

Hi @.***(https://github.com/erikh) , What could be an option? Perhaps to move the comment lines outside the code block?

Also a side note, This style of combining comments with the command to be executed within a block is seen at multiple pages throughout the site. So the issue being raised is not local to this page.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

erikh commented 6 months ago

sorry I really quickly wanted to expand on this: perhaps leave the comments in the page as they are, and modify the "copy to clipboard" function to fill the clipboard with the content minus comments that start at a line boundary. This way, the flow would be preserved for readers, you'd need to do a lot less copy editing, and the copied result would be safer for some users.

On Tuesday, January 23rd, 2024 at 8:41 PM, Erik Hollensbe (OSS) @.***> wrote:

Well, I think the ideal option would be to include the comments but use another method of describing commands and literal locations. That said, I cannot think of a "better" syntax for this that doesn't really create the same problem.

Perhaps that is the best approach, or at least don't make it part of the copied content. Is that a sensible approach?

On Tuesday, January 23rd, 2024 at 8:37 PM, adityasamant25 @.***> wrote:

Hi @.***(https://github.com/erikh) , What could be an option? Perhaps to move the comment lines outside the code block?

Also a side note, This style of combining comments with the command to be executed within a block is seen at multiple pages throughout the site. So the issue being raised is not local to this page.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

erikh commented 6 months ago

... for some reason I mis-remembered a copy tool, I'm sorry about that.

On Tuesday, January 23rd, 2024 at 8:48 PM, Erik Hollensbe (OSS) @.***> wrote:

sorry I really quickly wanted to expand on this: perhaps leave the comments in the page as they are, and modify the "copy to clipboard" function to fill the clipboard with the content minus comments that start at a line boundary. This way, the flow would be preserved for readers, you'd need to do a lot less copy editing, and the copied result would be safer for some users.

On Tuesday, January 23rd, 2024 at 8:41 PM, Erik Hollensbe (OSS) @.***> wrote:

Well, I think the ideal option would be to include the comments but use another method of describing commands and literal locations. That said, I cannot think of a "better" syntax for this that doesn't really create the same problem.

Perhaps that is the best approach, or at least don't make it part of the copied content. Is that a sensible approach?

On Tuesday, January 23rd, 2024 at 8:37 PM, adityasamant25 @.***> wrote:

Hi @.***(https://github.com/erikh) , What could be an option? Perhaps to move the comment lines outside the code block?

Also a side note, This style of combining comments with the command to be executed within a block is seen at multiple pages throughout the site. So the issue being raised is not local to this page.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

aj11anuj commented 5 months ago

/retitle Issue in copy-pasting snippets in terminal having comments /sig docs /kind feature

This issue is related to problem in copy-pasting snippets with comments in terminal. It doesn't seem a page or language specific issue. /remove-language en

Ritikaa96 commented 5 months ago

/area web-development

k8s-triage-robot commented 2 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 1 month ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

Ritikaa96 commented 1 month ago

I think this is worth working on as an issue. /remove-lifecycle rotten