phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) (04/16/91)
First of all, the "df" command does not always know how to find the file system a particular path name it is given is on. This is what I get: phil@ux2:/u/phil 2> df . Filesystem Total KB free %used iused %iused Mounted on Cannot find file system . phil@ux2:/u/phil 3> pwd /u/phil So apparently I need some other way to find out the file system I am on that is also portable over other UNIX platforms. Until AIX, that was "df" itself. If IBM "designed" it this way... WHY? Second thing. I have a few programs that were written with direct system calls rather that C library calls, for I/O. These programs work on all my other UNIX platforms but do not work on AIX. The sympton is that nothing effectively happens. One example is a program that tabifies its input. The result is simply that the program gets an immediate EOF on stdin, not an error. I know I have not given much information. I have not yet tried these on SysVR4 (which I consider to be "grossly broken by design", which is far worse than AIX appears to be). What I am asking for is what leads you might be able to suggest in debugging these programs. Do read() and write() have a different "design" in AIX? Is there any way to get machine language output from the C compiler? -- /***************************************************************************\ / Phil Howard -- KA9WGN -- phil@ux1.cso.uiuc.edu | Guns don't aim guns at \ \ Lietuva laisva -- Brivu Latviju -- Eesti vabaks | people; CRIMINALS do!! / \***************************************************************************/
sanders@cactus.org (Tony Sanders) (04/16/91)
If you are running AIX2.something (on an RT for example) then "df" works the way you described (I don't know why), however it should work the way you expect on AIX3.1 (RS/6000) unless your directory is unreadable or corrupted. In article <1991Apr15.182214.10391@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: >Is there any way to get machine language output from the C compiler? You want to check out the "Compiler Options" in info on AIX3.1 if you are on an RS/6000 (I think -qlist does what you want). That might also work for the RT but I can't say for sure because my RT is unplugged. For the other stuff you'll need to post more specific information. As far as I know read()/write() work correctly on all versions of AIX. -- sanders@cactus.org Brilliance is typically the act of an individual, but incredible stupidity can usually be traced to an organization. -- "More Programming Perls", Jon Bentley I am not an IBM representative, I speak only for myself.
jfh@greenber.austin.ibm.com (John F Haugh II) (04/16/91)
In article <1991Apr15.182214.10391@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: >So apparently I need some other way to find out the file system I am on >that is also portable over other UNIX platforms. Until AIX, that was "df" >itself. > >If IBM "designed" it this way... WHY? "df" does not work the way you expect for all versions of UNIX. In particular, most older AT&T derived UNIX systems do not give the filesystem for a given file. Short of writing C code, I don't know of any mechanism for doing what you want. [ You could fondle the mount table and see what mount point has the appropriate path prefix, but that is not guaranteed to work ] -- John F. Haugh II | I've Been Moved | MaBellNet: (512) 838-4340 SneakerNet: 809/1D064 | AGAIN ! | VNET: LCCB386 at AUSVMQ BangNet: ..!cs.utexas.edu!ibmchs!auschs!snowball.austin.ibm.com!jfh (e-i-e-i-o)
jsalter@ibmpa.awdpa.ibm.com (04/16/91)
In article <1991Apr15.182214.10391@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: >First of all, the "df" command does not always know how to find the file >system a particular path name it is given is on. This is what I get: > phil@ux2:/u/phil 2> df . > Filesystem Total KB free %used iused %iused Mounted on > Cannot find file system . > phil@ux2:/u/phil 3> pwd > /u/phil >If IBM "designed" it this way... WHY? IBM did not design it this way. When I try it on both 3003 and 3005 systems, I get the proper answer: % pwd /u/jsalter % df . Filesystem Total KB free %used iused %iused Mounted on /dev/lv02 200704 4980 97% 12428 24% /u % You must be running on an *early* version (pre-GA?). You need an upgrade. >/ Phil Howard -- KA9WGN -- phil@ux1.cso.uiuc.edu | Guns don't aim guns at \ jim/jsalter IBM PSP, Palo Alto T465/(415)855-4427 VNET: JSALTER at AUSVMQ Internet: jsalter@slo.awdpa.ibm.com UUCP: ..!uunet!ibmsupt!jsalter "IBM part #23521, aka Lt. Commander Data" The stuff above is on my own.
kline@ux1.cso.uiuc.edu (Charley Kline) (04/16/91)
jsalter@ibmpa.awdpa.ibm.com writes: >You must be running on an *early* version (pre-GA?). You need an upgrade. Gee, I'm on the same system Phil is. It's an S6000 model 540 running 3003. I can't get df to misbehave either. | 507 ux2. pwd | /usr/local/X11R4/mit | 508 ux2. df . | Filesystem Total KB free %used iused %iused Mounted on | /dev/lv01 151552 7672 94% 6833 17% /usr/local/X11R4 | 509 ux2. cd | 510 ux2. pwd | /u/kline | 511 ux2. df . | Filesystem Total KB free %used iused %iused Mounted on | /dev/hd1 163840 56376 65% 6493 15% /u | 512 ux2. ________________________________________________________________________ Charley Kline, KB9FFK, PP-ASEL c-kline@uiuc.edu University of Illinois Computing Services Packet: kb9ffk@w9yh 1304 W. Springfield Ave, Urbana IL 61801 (217) 333-3339
jmaki@vipunen.hut.fi (Jussi M{ki) (04/16/91)
It's not problem with pre-historic AIX-version. The problem appeares when the directory which you try to df is protected so that only owner can access it. We are running currently 3003 (bos.obj is 3.1.3.18). Here's litle demo on that df-problem vipunen%<~> 5: ls -ld test drwx------ 2 jmaki staff 512 Mar 08 19:53 test vipunen%<~> 6: cd test vipunen%<test> 7: df . Filesystem Total KB free %used iused %iused Mounted on Cannot find file system . vipunen%<test> 8: chmod a+x . vipunen%<test> 9: ls -ld . drwx--x--x 2 jmaki staff 512 Mar 08 19:53 . vipunen%<test> 10: df . Filesystem Total KB free %used iused %iused Mounted on /dev/lv00 884736 109792 87% 40531 18% /u1 Jussi M{ki | Internet: jmaki@hut.fi Helsinki University of Technology, Finland | Bitnet: jmaki@fingate.bitnet Computing Centre | Voice: + 358 - 0 - 451 4317 Systems Support Division | Telefax: + 358 - 0 - 464 788
bob@ibmpa.awdpa.ibm.com (Bob Andrews) (04/17/91)
In article <1991Apr16.045432.10283@ibmpa,awdpa.ibm.com>, jsalter@ibmpa.awdpa.ibm.com writes: |> In article <1991Apr15.182214.10391@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: |> >First of all, the "df" command does not always know how to find the file |> >system a particular path name it is given is on. This is what I get: |> |> > phil@ux2:/u/phil 2> df . |> > Filesystem Total KB free %used iused %iused Mounted on |> > Cannot find file system . |> > phil@ux2:/u/phil 3> pwd |> > /u/phil |> |> >If IBM "designed" it this way... WHY? |> |> IBM did not design it this way. |> When I try it on both 3003 and 3005 systems, I get the proper answer: |> |> % pwd |> /u/jsalter |> % df . |> Filesystem Total KB free %used iused %iused Mounted on |> /dev/lv02 200704 4980 97% 12428 24% /u |> % |> I found that df works just fine...as long as user bin has access to the directory you were cd'ed into. If not, well, df is setuid to bin, and it fails. -- --- Bob Andrews UNIX: bob@ibmpa.awdpa.ibm.com VNET: BANDREWS at AUSTIN (if you must)
wohler@sapwdf.UUCP (Bill Wohler) (04/17/91)
phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: >Subject: Re: It works everywhere else, but not on AIX phil, first, *never* use absolutes. for example, you cannot specify arbitrary directories with hpux's df, therefore it doesn't work *everywhere*. ;-) however, you can specify an arbitrary directory with df on suns, decs and, surprise, aix: [wohler@aix3:902]% df -i . Filesystem Total KB free %used iused %iused Mounted on aix1:/usr/aix/a 155648 50240 67% - - /tmp_mnt/auto0ERIAAA i don't know offhand of a way to determine without df which filesystem you're on. but perhaps your alias for df is breaking it or you're running someone's hack and not the system df. try which(1). we have not observed read() and write() to behave differently than other systems. good question: an option to request assembler output is *not* documented. -- --bw ----- Bill Wohler <wohler@sap-ag.de> <sapwdf!wohler> Heidelberg Red Barons Ultimate Frisbee Team
dcm@codesmith.austin.ibm.com (Craig Miller) (04/17/91)
In article <1991Apr16.183547@ibmpa.awdpa.ibm.com> bob@ibmpa.awdpa.ibm.com (Bob Andrews) writes: > >I found that df works just fine...as long as user bin has access to the >directory you were cd'ed into. If not, well, df is setuid to bin, and >it fails. Well, df *used* to be setuid to bin. Don't ask me why. Maybe /dev/hd* were all readable by bin and someone wanted to do df's on unmounted filesystems? Heck, I don't know. We fixed that a few releases back, I believe. It also caused some weird NFS errors... Craig -- Craig Miller Internet: dcm@aixwiz.austin.ibm.com IBM Austin Vnet: tkg007 at ausvmq AIXV3 Change Team (level3) IBM internal: dcm@littleguy.austin.ibm.com "I do not represent IBM or any other respectable company."
gs26@prism.gatech.EDU (Glenn R. Stone) (04/18/91)
In <1991Apr16.160043.20354@ux1.cso.uiuc.edu> kline@ux1.cso.uiuc.edu (Charley Kline) writes: >jsalter@ibmpa.awdpa.ibm.com writes: >>You must be running on an *early* version (pre-GA?). You need an upgrade. >Gee, I'm on the same system Phil is. It's an S6000 model 540 running 3003. >I can't get df to misbehave either. Must've been fixed in 3003, because my 3002 *does* misbehave occasionally.... seemingly at random. (this on 320's, 520, 530...) <sigh> C'mon, 3005! -- Glenn R. Stone glenns@eas.gatech.edu
gs26@prism.gatech.EDU (Glenn R. Stone) (04/18/91)
In <1991Apr16.183547@ibmpa.awdpa.ibm.com> bob@ibmpa.awdpa.ibm.com (Bob Andrews) writes: >I found that df works just fine...as long as user bin has access to the >directory you were cd'ed into. If not, well, df is setuid to bin, and >it fails. Ahhh, sooooo.... any idea *why* df would be setuid bin? nasssty behaviour, that. <doublesigh> - Glenn R. Stone glenns@eas.gatech.edu
john@crcaus.cactus.org (John R. Miller) (04/18/91)
In article <1991Apr15.182214.10391@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: >First of all, the "df" command does not always know how to find the file >system a particular path name it is given is on. This is what I get: > > phil@ux2:/u/phil 2> df . > Filesystem Total KB free %used iused %iused Mounted on > Cannot find file system . > phil@ux2:/u/phil 3> pwd > /u/phil > >So apparently I need some other way to find out the file system I am on >that is also portable over other UNIX platforms. Until AIX, that was "df" >itself. > >If IBM "designed" it this way... WHY? I can't tell from your posting which version of AIX you're running. This is normal USG behavior. On SysIII machines (for example) one has to give df a mount point or special file (i.e., a file system). This is the way df behaves on AIX2.2.1 on the rt. BSD allows one to specify a file and returns the free space of the file system on which it resides. "." is a common choice, but any file will do. This is the way df behaves on AIX3.1 on the s/6000. There was a problem with early releases of 3.1 in that df was suid bin so that if "." (or whatever) wasn't readable by bin df would fail. This has been corrected in later releases (3.1.5, I think.) Of course, it's simple enough to correct: just un-suid df. -- John R. Miller 13102 Briar Hollow Dr. Austin, Texas 78729 hm: 512/331-0155 john@crcaus.cactus.org or ..cs.utexas.edu!bigtex!crcaus!john wk: 512/823-3867 john@glasnost.austin.ibm.com
karish@mindcraft.com (Chuck Karish) (04/18/91)
In article <1991Apr15.182214.10391@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: >First of all, the "df" command does not always know how to find the file >system a particular path name it is given is on [ ... ] > >So apparently I need some other way to find out the file system I am on >that is also portable over other UNIX platforms. Until AIX, that was "df" >itself. This method has never been portable. AIX 2.2.1 is based on SVR2, which, I believe, did not support the desired behavior. SCO UNIX doesn't support it. A/UX 1.2 lets the administrator decide which filesystems are reported by df, so it won't work reliably there, either. How to do this portably? Write a program that calls stat() and uses the major and minor device numbers to figure out which of the filesystems returned by mount(8) is the right one. If you want to do it all in a shell script, use cpio (portability warning! it's not everywhere) to save the directory, and read out the major and minor numbers with dd. Schemes based on comparing the prefix from `pwd` to mount(8) output can be fooled by symbolic links. >Second thing. I have a few programs that were written with direct system >calls rather that C library calls, for I/O. These programs work on all my >other UNIX platforms but do not work on AIX. Get back to us on this one when you have a question. read() and write() work fine for me on AIX. I've compiled a number of imported programs on AIX with little porting work needed, and no special consideration for read() and write() on regular files. Chuck Karish karish@mindcraft.com Mindcraft, Inc. (415) 323-9000
shore@theory.tn.cornell.edu (Melinda Shore) (04/18/91)
In article <313@crcaus.cactus.org> john@crcaus.UUCP (John R. Miller) writes: >Of course, it's simple >enough to correct: just un-suid df. The reason that df is setuid is so that it can read device special files for the filesystems without making them world-readable. If you turn off the setuid bit on df it should fail; if it doesn't you've got a security problem. It *should* be setuid root. There's no compelling reason for it not to be, and plenty of reasons why it should. -- Software longa, hardware brevis Melinda Shore - Cornell Information Technologies - shore@theory.tn.cornell.edu
jfh@greenber.austin.ibm.com (John F Haugh II) (04/19/91)
In article <1991Apr18.130033.1472@batcomputer.tn.cornell.edu> shore@theory.tn.cornell.edu (Melinda Shore) writes: |In article <313@crcaus.cactus.org> john@crcaus.UUCP (John R. Miller) writes: |>Of course, it's simple |>enough to correct: just un-suid df. | |The reason that df is setuid is so that it can read device special |files for the filesystems without making them world-readable. If |you turn off the setuid bit on df it should fail; if it doesn't |you've got a security problem. It *should* be setuid root. There's |no compelling reason for it not to be, and plenty of reasons why it |should. No - "df" does not need to read the device file. There is a system call, statfs(), which will return the correct information regarding the file system, and it does not require any kernel privileges. That is what AIX uses to determine the free space, so John is correct in saying it doesn't need to be setuid "bin". This isn't the case for all of the various flavours of AIX, but it is true for v3. v1 and v2 (I think) do not include statfs(). They would have to have setuid bits turned on for df (and my PS/2 is setuid "root", as is expected.) -- John F. Haugh II | I've Been Moved | MaBellNet: (512) 838-4340 SneakerNet: 809/1D064 | AGAIN ! | VNET: LCCB386 at AUSVMQ BangNet: ..!cs.utexas.edu!ibmchs!auschs!snowball.austin.ibm.com!jfh (e-i-e-i-o)
mcuddy@rutabaga.Rational.COM (Mike Cuddy) (04/19/91)
sanders@cactus.org (Tony Sanders) writes: >If you are running AIX2.something (on an RT for example) then "df" works the >way you described (I don't know why), however it should work the way you >expect on AIX3.1 (RS/6000) unless your directory is unreadable or corrupted. >In article <1991Apr15.182214.10391@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: >>Is there any way to get machine language output from the C compiler? >You want to check out the "Compiler Options" in info on AIX3.1 if you >are on an RS/6000 (I think -qlist does what you want). That might also >work for the RT but I can't say for sure because my RT is unplugged. >For the other stuff you'll need to post more specific information. >As far as I know read()/write() work correctly on all versions of AIX. >-- sanders@cactus.org >Brilliance is typically the act of an individual, but incredible stupidity can >usually be traced to an organization. -- "More Programming Perls", Jon Bentley >I am not an IBM representative, I speak only for myself. I don't know if this is violating non-diclosure agreements ... (I was, at one time a contracter working in Austin on AIX... ) the first pass at 'df' didn't resolve '.' (stuff before 893?) Myself and other folks gritched at the developer until he added it... after my nagging him for a week to add the resolve '.' function (using arguments like, ''well, it workds everywhere else'') He added a function called 'resolve_dot_for_mcuddy' just to get me off of his back (Hi Dean!) I don't thing the function is called that any more though... peer code reviews and all ;-) --Mike Cuddy "...He's a UNIX hack and he's okay, he works all night and he sleeps all day..." Well, where I come from, we have a saying: "If you're not going to grab the bull by the horns while the iron is in the fire, then get off the pot." (There are a lot of chemicals in the water where I come from.) -- Dave Barry