Skip to content
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

cpud: server: add flags to cpud -remote #239

Closed
wants to merge 1 commit into from

Conversation

Lencerf
Copy link
Contributor

@Lencerf Lencerf commented Aug 29, 2023

Currently the cpud server starts commands by executing cpud -remote plus the command string sent from the client. There is no way to start cpud -remote with -d on.

This patch adds -d to cpud -remote if the cpud server is running with -d.

Currently the cpud server starts commands by executing
`cpud -remote` plus the command string sent from the client.
There is no way to start `cpud -remote` with `-d` on.

This patch adds `-d` to `cpud -remote` if the cpud server
is running with `-d`.

Signed-off-by: Changyuan Lyu <[email protected]>
@rminnich
Copy link
Member

rminnich commented Sep 1, 2023

actually I don't think this is needed.

rminnich@pop-os:~/go/src/github.com/u-root/cpu$ cpu vf2 -d /bbin/elvish
1970/01/01 00:21:02 CPUD(remote):Args [/bbin/cpud -remote -port9p=41841 -d /bbin/elvish] pid 71 *runasinit false *remote true env [SHELL=/bin/bash GTK_IM_MODULE=ibus XMODIFIERS=@im=ibus PWD=/home/rminnich/go/src/github.com/u-root/cpu LOGNAME=rminnich XDG_SESSION_TYPE=tty MOTD_SHOWN=pam HOME=/home/rminnich LANG=en_US=
/tmp/cpu/lib /lib none defaults,bind 0 0
/tmp/cpu/lib64 /lib64 none defaults,bind 0 0
/tmp/cpu/usr /usr none defaults,bind 0 0
/tmp/cpu/bin /bin none defaults,bind 0 0
/tmp/cpu/etc /etc none defaults,bind 0 0
/tmp/cpu/home /home none defaults,bind 0 0
 CPU_TMPMNT=/tmp TERM=ansi]
1970/01/01 00:21:02 CPUD(remote):args ["/bbin/elvish"], port9p 41841
1970/01/01 00:21:02 CPUD(remote):session:call s.NameSpace
1970/01/01 00:21:02 CPUD(remote):session:Dial [::1]:41841
1970/01/01 00:21:02 CPUD(remote):session:Dial [::1]:41841:dial tcp [::1]:41841: connect: connection refused
1970/01/01 00:21:02 CPUD(remote):session:Dial 127.0.0.1:41841
1970/01/01 00:21:02 CPUD(remote):session:Connected: write nonce 19294c6c3f29ccd2d52e1a123ab49e9b

1970/01/01 00:21:02 CPUD(remote):session:Wrote the nonce
1970/01/01 00:21:02 CPUD(remote):session:fd is 9
1970/01/01 00:21:02 CPUD(remote):session:mount 127.0.0.1 on /tmp/cpu 9p 0x6 version=9p2000.L,trans=fd,rfdno=9,wfdno=9,uname=rminnich,debug=0,msize=65536
1970/01/01 00:21:02 CPUD(remote):session:mount done
1970/01/01 00:21:02 CPUD(remote):session:Mounting "\n/tmp/cpu/lib /lib none defaults,bind 0 0\n/tmp/cpu/lib64 /lib64 none defaults,bind 0 0\n/tmp/cpu/usr /usr none defaults,bind 0 0\n/tmp/cpu/bin /bin none defaults,bind 0 0\n/tmp/cpu/etc /etc none defaults,bind 0 0\n/tmp/cpu/home /home none defaults,bind 0 0\n"
1970/01/01 00:21:02 CPUD(remote):session:Terminal ready
1970/01/01 00:21:02 CPUD(remote):session:dropPrives: uid is 0
1970/01/01 00:21:02 CPUD(remote):session:dropPrivs: not dropping privs
1970/01/01 00:21:02 CPUD(remote):session:runRemote: command is []

works fine.

Of course it also means users can set arbitrary options to cpud, which seems ... bad. Possibly we should be filtering them?

@Lencerf
Copy link
Contributor Author

Lencerf commented Sep 2, 2023

Of course it also means users can set arbitrary options to cpud, which seems ... bad.

Actually we can even do something likecpu vf2 -remote=false /bbin/elvish and this will make the cpud process starts as a server instead of the remote mode.

From the perspective of a user of the client package, client.Command("vf2", "-d", "/bbin/elvish") looks really strange ...

@rminnich
Copy link
Member

rminnich commented Sep 4, 2023

We need to figure this out. I realize that looks strange but ... I don't think "looks really strange" is enough to make it unacceptable. The ability for a user to easily enable debugging for a single session is really handy.

@rminnich
Copy link
Member

ok, I THINK with the merge of #246, this PR is not needed.
Note that I have fixed the problem changyuan pointed out, above.

@Lencerf Lencerf closed this Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants