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

Keep track of processed ttys and only start same one once #2742

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@deitch
Copy link
Collaborator

deitch commented Nov 15, 2017

Signed-off-by: Avi Deitcher avi@deitcher.net

- What I did

Added deduplication logic to linuxkit/getty so that if the same line appears twice as console=, it will only start each once.

Also logs what it is doing.

Fixed 2741

- How I did it
Updated /usr/bin/rungetty.sh

- How to verify it

  1. Run a linuxkit .yml file with duplicate console= lines
  cmdline: "console=tty0 console=ttyS0 console=ttyAMA0 console=ttyS0 console=tty0"
  1. moby build
  2. linuxkit run
  3. Log in, see that /var/log/getty.out.log shows it starting only once. Also verify with ps -ef if you want.

- Description for the changelog

Prevent getty from starting getty twice for same tty

- A picture of a cute animal (not mandatory but encouraged)

baboob

Keep track of processed ttys and only start same one once
Signed-off-by: Avi Deitcher <avi@deitcher.net>
@deitch

This comment has been minimized.

Copy link
Collaborator

deitch commented Nov 15, 2017

Pushed out in arm64 and x86

return
fi
# now indicate that we are processing it
PROCESSEDTTY="${PROCESSEDTTY} ${tty}"

This comment has been minimized.

@ijc

ijc Nov 16, 2017

Collaborator

One way to achieve a similar thing without quite so much shell gymnastics and grep etc would be touch /var/lock/getty.${tty} and if [ -e /var/lock/getty.${tty} ].

This comment has been minimized.

@justincormack

justincormack Nov 29, 2017

Collaborator

ping @deitch any preference here?

This comment has been minimized.

@deitch

deitch Nov 29, 2017

Collaborator

No preference. I am happy to leave it this way or change it. @ijc and @justincormack do you care?

This comment has been minimized.

@justincormack

justincormack Nov 29, 2017

Collaborator

I think files are nicer than env vars. I would use /tmp though I think as its really only temporary to a short run of this program.

This comment has been minimized.

@deitch

deitch Nov 29, 2017

Collaborator

It isn't really an env var, just a var in the context of the script (probably should not have named it in caps...).

This comment has been minimized.

@deitch

deitch Nov 30, 2017

Collaborator

The more I think about it, more I think I would prefer to leave it as is. This isn't intended to survive process restarts or anything, as you said:

its really only temporary to a short run of this program.

so why not just leave it as memory (var) inside program?

This comment has been minimized.

@ijc

ijc Nov 30, 2017

Collaborator

The machinations to extract things from the var are the thing I don't like, rather than the fact of the var itself. Files would be cleaner in that regard.

This comment has been minimized.

@deitch

deitch Nov 30, 2017

Collaborator

machinations to extract things from the var

Having a var contain an item and then seeing if the var contains that item? Isn't that a pretty standard way of keeping track of things?

True, it would be better with a hash/map/dict/whatever, but those don't exist in sh.

@deitch

This comment has been minimized.

Copy link
Collaborator

deitch commented Jan 4, 2018

This one is open 6 weeks later, can we just take it as is?

@justincormack

This comment has been minimized.

Copy link
Collaborator

justincormack commented Jan 4, 2018

I think there was a preference for using files...

@deitch

This comment has been minimized.

Copy link
Collaborator

deitch commented Jan 4, 2018

I think there was a preference for using files...

I was neutral, but I kind of dislike polluting the filesystem to keep track of things that are tracked in a single process. Why not keep it in memory?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment