Re: [zones-discuss] ps -Z is broken
On Sat 29 Sep 2007 at 11:44AM, Peter Tribble wrote: OK, I've seen Andy's reply in the pgrep thread, so basically I believe we should just print out the whole zone name. In other words, %8.8s becomes %8s, and if it's short it will line up like it does at the moment. If it's long, it will be ugly but accurate. I agree. I should also fix the zone header so that everything will line up properly if the zone names are short enough. Which then leads to the question: how should the ZONE header line up? At the moment it's in the middle of its column with 2 spaces either side - which seems odd given that most headers are right-justified. I'm tempted to push this to the right as well. Weird, I thought it *was* right justified in the column? Maybe you can post an example of what you mean; I see this: ZONE PID TTY TIME CMD global 9056 pts/8 0:00 vim global 9072 pts/8 0:00 ps global 9055 pts/8 0:00 sh And to me it looks right justified, since the PID column is 5 digits in width. And should the username truncation problem be addressed as well? (And if so, done as part of this or separately?) I presume this is the web page mentioned earlier: Well, I don't know the answer, I'm not very knowledgable about user names. My suggestion would be to tackle the zone problem first, since it is small and uncontroversial (to me, anyway). As you point out, the output is not very useful, so I can't imagine anyone would have built anything which depends upon it. I'm happy to sponsor a fix, or can develop one when I have the chance. -dp -- Daniel Price - Solaris Kernel Engineering - [EMAIL PROTECTED] - blogs.sun.com/dp ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] ps -Z is broken
Nicolas Williams [EMAIL PROTECTED] wrote: On Sat, Sep 29, 2007 at 12:42:38PM +0200, Joerg Schilling wrote: Nicolas Williams [EMAIL PROTECTED] wrote: The 8 character limit is all about column formatting in tools like ps(1) and ls(1). The 32 byte limit is from utmpx. utmpx has no specific user name limit in POSIX. Maybe so, but: struct utmpx { charut_user[32];/* user login name */ ... That's what's in Solaris. And the layout (and probably size) of struct utmpx is part of the ABI. Before POSIX.1-2001, there indeed was a hard limit but this limit was from TAR! With the new extended tar headers from POSIX.1-2001, user names could be _really_ llong. Fine, but then we have to extend utmpx. If people like user names longer than 31 chars, yes. POSIX did introduce the extended names in the TAR extended headers for two reasons: 1) Allow a unique coding (UTF-8) for better portability of the archives 2) Remove the length limit Jörg -- EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin [EMAIL PROTECTED](uni) [EMAIL PROTECTED] (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] ps -Z is broken
On 9/26/07, Nicolas Williams [EMAIL PROTECTED] wrote: Why do you think we limit usernames to 8 characters still? It's because of things like ps(1) and ls(1) that like to use fixed-width columns. But they aren't limited to 8 characters. Usernames can be longer. Even worse is the lack of consistency - as I recall ps -u looks at the first 10 characters of a username when looking for a match. We need to get rid of this, once and for all. Note: each zone has its own user/group name/ID namespaces. I know that. In most of my cases, though, all use the same nameservice, so that the uid-username mapping is consistent and if you run ps/top/prstat/whatever in the global zone then the usernames reported are accurate. -- -Peter Tribble http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/ ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] ps -Z is broken
On Fri, Sep 28, 2007 at 09:41:27PM +0100, Peter Tribble wrote: On 9/26/07, Nicolas Williams [EMAIL PROTECTED] wrote: Why do you think we limit usernames to 8 characters still? It's because of things like ps(1) and ls(1) that like to use fixed-width columns. But they aren't limited to 8 characters. Usernames can be longer. Yes. And no. There's a large variety of silly limits on username length, from 8 _characters_ (or is it width? well, we don't really do I18N for usernames...) to 32 _bytes_. The 8 character limit is all about column formatting in tools like ps(1) and ls(1). The 32 byte limit is from utmpx. Usernames = 8 chars will work for everything. Usernames 8 chars may break some scripts. Usernames 32 may fail to login, and anyways their usernames will be truncated in utmpx. Even worse is the lack of consistency - as I recall ps -u looks at the first 10 characters of a username when looking for a match. We need to get rid of this, once and for all. Yes, yes we do. IIRC there are bugs filed for this, and Darren Moffat has a web page somewhere listing all of these problems. Nico -- ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] ps -Z is broken
On Wed, Sep 26, 2007 at 08:35:24PM -0700, Hugh McIntyre wrote: How about a variant of: ps -o zone,user,pid,args -u fred Indeed my copy of the man page says to use ps -o if you want longer zone names. Oh goody. ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] ps -Z is broken
On 9/26/07, Nicolas Williams [EMAIL PROTECTED] wrote: On Wed, Sep 26, 2007 at 10:19:07PM +0100, Peter Tribble wrote: I've just noticed something else. If you have an 8-character username it runs into the zone name in the output on S10. On nevada 69, there's a space but the headers don't line up. (I'm guessing that a space was added after the zonename but that the ZONE header didn't get the extra space added.) Now *that* would be a bug. Specifically, that would be bug 6610013. -- -Peter Tribble http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/ ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] ps -Z is broken
On 9/26/07, Nicolas Williams [EMAIL PROTECTED] wrote: On Wed, Sep 26, 2007 at 10:19:07PM +0100, Peter Tribble wrote: I've just noticed something else. If you have an 8-character username it runs into the zone name in the output on S10. On nevada 69, there's a space but the headers don't line up. (I'm guessing that a space was added after the zonename but that the ZONE header didn't get the extra space added.) Now *that* would be a bug. Specifically, that would be bug 6610013. It would be nice to have a generic option for make everything fit or, alternatively, a syntax like: ps -o zone:12,user:18 etc, which would allow you to specify the width of a column. Casper ___ zones-discuss mailing list zones-discuss@opensolaris.org
[zones-discuss] ps -Z is broken
But how best to fix it? The actual problem is in the following bug: http://bugs.opensolaris.org/view_bug.do?bug_id=6275455 See 6400962 for more text. (Even though that seems to have resulted in a manpage entry that says, effectively, that you shouldn't use the -Z flag.) Essentially, ps -Z only prints max 8 characters of the zonename, which is completely useless - even dangerous. The idea that this could be closed as not a defect beggars belief. A fixed width (ie. just widening the field) isn't the answer. It should display all the zone name whatever. Isn't this as easy as changing the format specifier from %8.8s to %8s? OK, so then the columns don't line up. How much is this a problem? I know that I need the full zone name, and that this is far more important than the output lining up. (I also don't regard output format compatibility as a good argument, as the current output simply isn't useful.) (The same is true of usernames, which also get truncated. That's bad as well, but at least you can see the history there as usernames have traditionally been limited to 8 characters, but zone names can and often are much longer.) Thoughts? -- -Peter Tribble http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/ ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] ps -Z is broken
On Wed, Sep 26, 2007 at 09:52:29PM +0100, Peter Tribble wrote: Isn't this as easy as changing the format specifier from %8.8s to %8s? OK, so then the columns don't line up. How much is this a problem? It's a big problem. Personally, I think ps needs an option to output non-column oriented text. In the meantime you can use ptree(1) and friends instead of ps(1) and avoid the problem, I think. Nico -- ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] ps -Z is broken
On 9/26/07, Nicolas Williams [EMAIL PROTECTED] wrote: On Wed, Sep 26, 2007 at 09:52:29PM +0100, Peter Tribble wrote: Isn't this as easy as changing the format specifier from %8.8s to %8s? OK, so then the columns don't line up. How much is this a problem? It's a big problem. Bigger than giving completely incorrect output? Personally, I think ps needs an option to output non-column oriented text. OK, so I need to work out how wide the column should be and expand it to suit? In the meantime you can use ptree(1) and friends instead of ps(1) and avoid the problem, I think. I'm not sure how that helps. The question I wanted ps to give me the answer to was simple: show me what processes a user is running, and add on which zone they're in so I know which zones are in use. Now, 'ps -flZ -u fred' would seem to be the ideal command to use, but due to this bug it isn't. (It gets even worse when truncated zone names become the same, and doubly worse when there's a valid 8-character zone name that matches a truncated name. G. Might be ever so easy to reboot the wrong zone by mistake ;-() I've just noticed something else. If you have an 8-character username it runs into the zone name in the output on S10. On nevada 69, there's a space but the headers don't line up. (I'm guessing that a space was added after the zonename but that the ZONE header didn't get the extra space added.) -- -Peter Tribble http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/ ___ zones-discuss mailing list zones-discuss@opensolaris.org
Re: [zones-discuss] ps -Z is broken
On 9/26/07, Peter Tribble [EMAIL PROTECTED] wrote: On 9/26/07, Nicolas Williams [EMAIL PROTECTED] wrote: On Wed, Sep 26, 2007 at 09:52:29PM +0100, Peter Tribble wrote: Isn't this as easy as changing the format specifier from %8.8s to %8s? OK, so then the columns don't line up. How much is this a problem? It's a big problem. Bigger than giving completely incorrect output? I agree that it is a bug. Names of zones, users, groups, projects, etc. should not be truncated unless the command allows me to specify the column width. I get what I deserve if I tell a command to be imprecise but the precision is important. Personally, I think ps needs an option to output non-column oriented text. OK, so I need to work out how wide the column should be and expand it to suit? Don't worry about the alignment. Sure it will be ugly, but ugly is better than wrong. Take vmstat, df, or any number of other commands as a precedent. I stopped using sar at a time when all the numbers started running together and I could no longer trust that the output was correct. In the meantime you can use ptree(1) and friends instead of ps(1) and avoid the problem, I think. I'm not sure how that helps. The question I wanted ps to give me the answer to was simple: show me what processes a user is running, and add on which zone they're in so I know which zones are in use. Now, 'ps -flZ -u fred' would seem to be the ideal command to use, but due to this bug it isn't. How about a variant of: ps -o zone,user,pid,args -u fred This may produce ugly yet correct output (assuming that all zones use the same name service - may break anyway if ps is too smart). You can adjust the columns to match the -flZ output if desired. -- Mike Gerdts http://mgerdts.blogspot.com/ ___ zones-discuss mailing list zones-discuss@opensolaris.org