LSB & Posix Conflicts 354
An anonymous reader writes "The OpenGroup has published a detailed list of the conflicts between the Linux Standards Base and Posix ? that is accessible through their website. "
"The following is not for the weak of heart or Fundamentalists." -- Dave Barry
POSIX is required! (Score:3, Insightful)
Oh yeah? POSIX can be DUMB! (Score:4, Informative)
Re:Oh yeah? POSIX can be DUMB! (Score:4, Informative)
"Since the user cannot specify the length of the buffer passed to gets(), use of this function is discouraged. The length of the string read is unlimited. It is possible to overflow this buffer in such a way as to cause applications to fail, or possible system security violations."
Re:Oh yeah? POSIX can be DUMB! (Score:5, Insightful)
Even the bash approach where you have to explicitly ask for POSIX-conforming behaviour is better than nothing, even if I think that it should be the default.
There are only two sane ways to deal with POSIX brain-damage: Fix POSIX, or don't use that stuff in your programs. OSes that are "mostly" POSIX-compatible are worse for portability that those who just say that they don't implement POSIX at all.
Re:Oh yeah? POSIX can be DUMB! (Score:5, Informative)
Re:Oh yeah? POSIX can be DUMB! (Score:5, Insightful)
This is on the same scale as your mother asking, "If all your friends jumped off a bridge, would you jump."
Them even bringing up gets() makes me doubt their whole report. If the rest of their comments are on the same scale as this, I'd say go with the LSB everytime.
The LSB overrides and superceeds all previous standards with a single common way of doing things that actually halfway makes sense.
Re:Oh yeah? POSIX can be DUMB! (Score:2)
If you don't know why gets is bad, the MacOS X man page has this, under BUGS:
Since it is usually impossible to ensure that the next input line is less
than some arbitrary length, and because overflowing the input buffer is
almost invariably a security violation, programs should NEVER use gets().
The gets() function exists purely to conform to ISO/IEC 9899:1990
(``I
Externality Problem (Score:3, Insightful)
I don't think your greasy hamburger example is analogous. If you eat greasy hamburgers and as a result have a poor quality of life, incur horrible medical expenses, and die a miserable death, it is arguably not society's business because all of the costs are internalized. (Unless, of course, yo
Re:Oh yeah? POSIX can be DUMB! (Score:2)
Hence the function is depricated but available with special compiler flags. That is the parachute
Re:Oh yeah? POSIX can be DUMB! (Score:4, Insightful)
The second comment it also wrong. If you have systems that are 90% POSIX compatable it much easier to port software to it than if it's 0% POSIX compatable. In the end you have a lot of #ifdef in you code or in the portable classes. The less #ifdef you have to do the easier it is. It does make it harder to debug though as you have to know the subtle differances.
Most of the time though you use a library that wrapes it all up for you like wxWindows or POSIX that makes it fairly portable. You just have to alway remember that different OS have different levels of completeness.
Re:Oh yeah? POSIX can be DUMB! (Score:2)
Actuatlly it is SQL 99.
The real problem is that it takes years for things to be added to standards, and years more for those standards to be implimented in most settings. So although PostgreSQL is nearly ANSI SQL 99 complient (core requirements), it is still being worked
Re:It's 'Most Stupid' no matter how many... (Score:3, Interesting)
Happy now?
Oh, and while I don't doubt that you know a few English majors that were good at programming, your statement would only make any sense if MOST English majors were good at programming. The thought process for reducing things to simple steps is at odds with the normal authors thought process in my experience.
Re:POSIX is required! (Score:5, Insightful)
No, that's why Linus couldn't implement it fully.
Re:POSIX is required! (Score:5, Interesting)
Re:POSIX is required! (Score:5, Informative)
2002, great, too bad it wasn't available in 1991.
From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)
Newsgroups: comp.os.minix
Subject: Gcc-1.40 and a posix-question
Message-ID:
Date: 3 Jul 91 10:00:50 GMT
Hello netlanders,
Due to a project I'm working on (in minix), I'm interested in the posix standard definition. Could somebody please point me to a (preferably) machine-readable format of the latest posix rules? Ftp-sites would be nice.
A month later, Linus posted:
As to POSIX, I'd be delighted to have it, but POSIX wants money for their papers, so that's not currently an option.
This June 1999 article is good: The Past and Future of Linux Standards [linuxjournal.com]
Also, this Dec 2000 interview with Linus [linux-mag.com] touches on Linux and POSIX/LSB standards.
To sum it all up: POSIX is good, LSB is good, let's work together towards world peace.
Re:POSIX is required! (Score:2)
In the early days of Java I read something about how the POSIX and Java models were similar for compliance testing. I have no idea if that is true anymore, as I haven't used Java since about the time I read that article
Re:POSIX is required! (Score:3, Interesting)
POSIX was designed back when they had to limit the length of strings because hardware was expensive. POSIX and LSB, sadly, happen to be the most nitpicking standards I've seen to date.
I intend to support the LSB, but give me innovation over a decaying standard. Do we want the Linux kernel to look like the x86 chip design?
Your P4 and Athlon can run code written for stop lights (Intel was in the stop light biz before the personal computer).
Besides with so many
UNIX standards base (Score:2, Funny)
POSIX LSB (Score:5, Insightful)
btw. check the following for more information on POSIX
http://www.posix.com/
http://standards.ie
Re:POSIX LSB (Score:2, Funny)
-- rms
Re:POSIX LSB (Score:5, Informative)
Funny thing you mention them in the same breath, since RMS was behing the original /usr/group that gave birth to POSIX.
Given that his world view isn't Linux-centric, I guess he'd be behind POSIX even today, as compliance would make eventual port to the Hurd easier in some measure; OTOH, many of the LSB extensions are actually the officialisation of GNU extensions in glibc and other GNU tools, so they don't hurt so much these days that software get ported from GNU to proprietary Unix instead of the other way round.
All things considered, standards should go together; extensions aren't bad if they bring benefits and are easily flaggable, but simple violations are evil if they can just creep in without bringing benefits nor being easily spotted.
Re:POSIX LSB (Score:2)
Re:POSIX LSB (Score:2)
Do you have any references? I could never find a nice history of POSIX.
Re:POSIX LSB (Score:4, Informative)
A standards document like this is not a holy book that everyone must use as a daily guide. Every aspect of a standard like this should be constantly under ruthless attack to do things better.
When I was in the Army every unit I was in had a Standard Operating Procedures (SOP) book. This document formalized the way things were being done at the time. This made it easier to train new people, but if someone came up with a better, easier, faster way of doing things and could get it accepted, guess what? That's right, they updated the book. So various units would evolve slowly overtime to the best way of getting the job done.
A document like POSIX or the LSB is actually merely a "best practices" book and should reflect the best practices of the times, not be some arbitrary thing that documents how things were done 20 years ago.
Not to mention the fact that POSIX is silent on way too many very important things that govern an actual Unix or Linux distribution.
If two Unix or Linux distributions meet POSIX this is no guarantee that they are compatible in any way shape or form. But if two distributions meet the LSB, then you are guaranteed a very high level of interoperablity between the two.
And there are easy to use tools that actually test compliance to the LSB.
Re:POSIX LSB (Score:5, Informative)
Posix is(shuld be) a subset of LSB meaning that a LSB system should support posix, not the other way around.
Posix have been implemented on hurd,*Nix,linux qnx 6,amiga os(Almost, but contain some problems with the filesystem functions, and fork) and I also think that beos got a posix layer. (Oh and windows got posix support too, you just can't use it together with other windows functions, so that support is rather pointless)
Martin
Re:POSIX LSB (Score:5, Informative)
Except that, well, it's not. There's a new POSIX (ISO/IEC 9945:2002) which is now the same as the Single Unix Specification, V3. The article is about the differences between LSB and this version of the standard.
Re:POSIX LSB (Score:4, Informative)
Except that many of these extensions and ways of doing things are only common on Linux systems. A program that adheres to POSIX isn't guaranteed portable to Linux, and a LSB compliant program isn't guaranteed to be portable to Solaris, BSD, AIX, HPUX, etc.
Re:offtopic: Who is "RMS"? (Score:3, Informative)
GN
Re:offtopic: Who is "RMS"? (Score:3, Interesting)
Not so! The GNU/Linux name signifies that GNU is running on top of the Linux kernel. But your long thing seems to say that, among other things, GNOME runs on top of KDE. GNOME is actually part of GNU, and I think a better way of referring to my system would be:
(KDE/XFree86 & GNU & BSD/Linux) & (Apache/GNU & BSD/Linux). Note the parentheses and ampersands.
Rationale (Score:5, Interesting)
I've read most of the article, and while there are some things that were clearly (and subjectively) chosen by the LSB group as being "better" (line 123, for example), others appear to be technical limitations (line 219, for example) and some are purely arbitrary (for example line 282).
A lot of time and experience went into creating POSIX, and on the whole it's pretty sound. It seems a shame not to leverage it, both from an academic perspective, and also because lack of POSIX-compliance is a barrier to porting existing applications to Linux.
WRONG! POSIX does some really dumb things!! (Score:5, Informative)
Also, in most cases the LSB is a superset of POSIX, but the contradictions are _minor_. Not show-stoppers.. not enough to require significant application rewrites when porting to Linux. So what if O_LARGEFILE is set most of the time? This is actually a good thing because most of the time it causes no problems. Even if you are checking the fd flags O_LARGEFILE being set isn't a problem as long as you check the flags in the _right_ way, that is logical AND'ing them with the flag you want to check for. The only time this contradiction causes a problem is if you are breing stupid and expecting the flags to be explicitly equal to some magic number you were expecting. Sure that is not exactly to spec, but for 99.9% of the apps out there it doesn't break compatibility, and if it does it's a one-line fix. However the benefint of fcntl() acting this way is clear -- most apps on linux have no problems with 64-bit file-sizes which are more and more common these days!
Re:WRONG! POSIX does some really dumb things!! (Score:4, Informative)
Now correct me if I'm wrong, but I'm pretty sure gets() was defined
in the ANSI C standard libraries, and these were subsequently adopted by POSIX?
Not to mention scanf()/sscanf()..
Re:Rationale (Score:5, Interesting)
259 The files at.allow and at.deny reside in
260 on LSB implementations.
Why, for the love of God, would you want them under
Face it, POSIX is just broken in some areas.
Re:Rationale (Score:4, Insightful)
Or, alternativly, why not? If it's just because your not used to it, then ponder it a bit more.
if
Why not reserve
Is there a good reason that configuration data must be all the way across the filesystem from the rest of the program? If you have a range of different machines, doing different tasks, all using one program in different manners, and NFS mount
Now, POSIX may be broken because it's inconsitant (some per-prog configuation in
One big advantage of this approach would be for a large number of systems, that NFS mount
Re:Rationale (Score:3, Informative)
Well, how about if you want to mount
BTW, installation/uninstallation of an app is the job of the package manager, not the user. If the PM knows what files belong to what package, what real advantage is there to having everything for that app under on directory?
Re:Rationale (Score:2)
at was (still is sometimes) implemented in terms of cron. It made sense to keep cron's stuff together. I agree, it's an idiotic place, but there should be symlinks.
Putting them directly in
Also: something has always been broken (Score:3, Informative)
When most Linux systems conform to POSIX behavior
Goldilinux and the three bears... (Score:5, Funny)
SCO: "Too similar"
TOG: "Too different"
LSB: "Just right!"
gets() (Score:4, Funny)
Won't somebody think of the script kiddies!
Re:gets() (Score:2, Insightful)
Re:gets() (Score:2, Funny)
I do, but then again, I'm working on a project that requires Windows compatibility.
Re:gets() (Score:2)
It's not even a matter of checking user input! (Score:5, Informative)
Dude, gets() is so bad, there is _no way_ to guarantee that the incoming string isn't going to totally cause a buffer overflow! _No way_! You can ioctl() with FIONREAD all you want, you still aren't guaranteed that the string you pass to gets() is actually big enough to hold the incoming text. At best you get a program crash -- at worst you get a hacker with root!
gets() is just bad, horrible, terrible design. You say something about checking the input to prevent overflows, but by the time you get the string back from gets() it's too late! The stack is already fsked. Or if it's on the heap you probably already crashed or your program is somehow otherwise corrupt...
Re:It's not even a matter of checking user input! (Score:2)
what I do (Score:4, Funny)
I'll admit it's a bit tedious, but it helps prevent gets overflows.
That is the STUPIDEST solution I have ever seen! (Score:2, Informative)
Secondly, if there was no data on stdin (e.g. closed pipe at other end) and you got unlucky during function initialization, you can overrun the dummy buffer with your strlen call. If there is no data, fgets will not alter dummy in any way, there is no guarantee that it is an ASCIZ string, and you call strlen on it. Boom! At least initialize dummy if you want consistent cod
Re:gets() (Score:3, Interesting)
Re:gets() (Score:3, Interesting)
Re:gets() (Score:3, Interesting)
LSB is going to be more important than POSIX.
Even right now, Unix developers consider more important being Linux compatible than being POSIX compatible.
Re:gets() (Score:2, Insightful)
Is that really what you're saying?
Someone inform Microsoft, they were right all along.
To resolve which standard is preferred... (Score:2)
Re:To resolve which standard is preferred... (Score:2)
Oh, good... Someone else who read the title and thought it referred to some problem between endianness and POSIX.
(Don't know if anyone else will notice you meant that as a joke, though...)
Re:To resolve which standard is preferred... (Score:2)
Nothing major (Score:5, Informative)
Some of the LSB PThreads stuff could be anoying, but currently very few implementations of PThreads are feature complete anyway. LSB and Linux have just as much chance as anyone else to bring themselves into line with POSIX.
Nothing too shocking, but it could be a handy reference. If in doubt though, stick with POSIX.
Affected C functions (Score:5, Funny)
102 2.1.3 getopt [...]
106 2.1.4 gets [...]
109 2.1.5 getservbyname [...]
112 2.1.6 getservent [...]
115 2.1.7 ioctl [...]
120 2.1.8 iswctype [...]
123 2.1.9 kill [...]
133 2.1.10 nice [...]
139 2.1.11 opterr, optind, optopt [...]
142 2.1.12 strptime
Pfff, we're saved. printf("Hello world\n") will still work on all platforms. Isn't it the standard portability test after all?
Re:Affected C functions (Score:3, Informative)
My hello program. (Score:2, Funny)
> GNU has helpfully published a version of "Hello, World!" that uses autoconf
Why make things so complicated!
Re:Affected C functions (Score:3, Funny)
Yeah, but check the description page to see why:
(emphasis added).
Who was it that said something about every program tending to add features until it includes a mail reader?
POSIX,LSB,BSD,heck, where is everything? (Score:5, Interesting)
Under BSD it seems to be better between the 2 net/free but could suffer the same fate as others start thinking of making their own flavors...
I want apache to be in the same place on every damn distro.... is it really that difficult to not screw with an install of a app?
Re:POSIX,LSB,BSD,heck, where is everything? (Score:5, Interesting)
POSIX compliance is mainly in the API
while the directory layout is a matter the LSB is approaching it is not part of POSIX specification except for some directories that must exist.
Detail [opengroup.org]
Re:POSIX,LSB,BSD,heck, where is everything? (Score:2)
Another problem is non-free software where you don't really have a choice where to put stuff, especially when the author(s)
Re:POSIX,LSB,BSD,heck, where is everything? (Score:2)
they believe in.
Note that the Debian project is just that, and Debian has probably the
most consistently well-thought out policy for where and how everything gets
installed.
The only problem is, it's different from everyone else's. Still, it
works. If what you were suggesting is all Linux distributions aim for
compliance with Debian policy, I'm behind you all the way. Or ahead of
you, whatever
Re:POSIX,LSB,BSD,heck, where is everything? (Score:2)
/var is for variable data. While web pages change, it's not exactly 'variable'.
/usr is good for the binaries, but the data is updated too much. Besides, it's common to mount /usr read only for security reasons.
/opt? That's for package data. An apache package could live there, but again the data changes, and opt could be mounted read only for the same reason /usr is.
/home? doesn't really fit either. There's a apache user for it, but it doesn't give multiple users easy access
Re:POSIX,LSB,BSD,heck, where is everything? (Score:2)
But, of course, that's not Microsoft's fault.
Re:POSIX,LSB,BSD,heck, where is everything? (Score:5, Informative)
C:\Program Files\
Ok, is explorer.exe in C:\Program Files\Microsoft\Windows\Explorer\ ? Or in C:\Windows\ ? Or in C:\Windows\System32\? Or in C:\Program Files\Explorer\? And where's iexplore.exe ? Where's the uninstaller for FooSoft Bar? C:\windows\unwise.exe ?
Now go and find those settings. Are they in C:\Documents and Settings\Windows User\Application Data\ ? Are they in C:\Program Files\Foo\Bar.ini ? In win.ini? Are they in the registry in HKLM? Or in HKCU? Or even in HKU\.DEFAULT? Or in a group policy? Or in a custom policy? Somewhere in Active Directory?
Where does iexplore put it's cache? How about MSIE 4? How about 5? How about if you run ME? in C:\Windows\Cache ? In c:\Documents and Settings\Windows User\Local Settings\Temp? Win98x doesnt even have C:\Documents and Settings!
When is %windir% C:\windows and when is it c:\winnt? Why is %windir% even an environment variables, people fuck with those!
Windows paths are a great big piling heap of.. Well, something unpleasant. And the registry doubly so. Granted, the *nix way of doing things isn't perfect, but at least it had homedirectories(!) with
Re:POSIX,LSB,BSD,heck, where is everything? (Score:2)
Oh, and you shouldn't use %windir% except in shell scripting, there's an API call to get the Windows directory. (Also home directory, temp directory, etc).
Mod parent up (Score:2)
Re:POSIX,LSB,BSD,heck, where is everything? (Score:3, Informative)
Hahahahahhahaha, guess you didn't have to support anything prior to Win95.
Right from the start. ROTFL!
Mind you, that was the least of the problems with Win3.x, but your statement is just silly.
Re:POSIX,LSB,BSD,heck, where is everything? (Score:2)
What? You are NOT using the german version?
I hate it when programs never check for the default install path and just hardcoded assume, it would be C:\Program Files\.
And I am pretty sure, it would be something like C:\Fiches des Programmes\ in the french version.
Don't tell me, Windows got it right from the start. They messed it up like everyone else. And this in the same company.
Re:POSIX,LSB,BSD,heck, where is everything? (Score:2)
Yet another problem of something DOS got right from the start.
(a default place to install everything)
Unless you're Microsoft, of course. Then you can put Excel in C:\MSOffice, and IE in C:\Windows.
And how about that name, "Program Files"? Could we get a little more ambiguous please? Very little of the contents of a computer hard drive is not "a file for a program". However, the situation has improved since that directory's introduction in Windows95. Before Microsoft created the separate "C:\My
Linux must improve POSIX conformance (Score:5, Interesting)
I do a lot of really high-performance multi-threaded programming, and the Linux threads model pretty much eliminates it from competing in that arena - and believe me, I'd love to be able to underbid any competition by constructing a Linux cluster of commodity pizza boxes.
There's no way doing a popen() or system() should hang a multithreaded process.
If IBM is really going to make Linux work on this sort of enterprise level, maybe they should make Linus an job offer with one crooked number followed by a blank and tell Linus: "Fill in as many zeros as you think is correct".
NPTL? (Score:5, Informative)
Re:Linux must improve POSIX conformance (Score:2)
A reasonable approach might be to use the Apache Runtime for those functions; apr_proc_create(?) combines the ability to do popen/p2open/system into one call which they claim is thread safe, and seems to be from my own experimentation. Well, that, and the fact that they are used f
Well (Score:2, Funny)
So many websites, so little time (Score:3, Interesting)
Re:So many websites, so little time (Score:2)
Before we had historians, poeple did things. Before we had journalists, people communicated. Before we had critics, people made artwork and music.
Never confuse progress with those that try to put the calipers of reason to it. Indeed, what is recognized as a trend doesn't really exist until everyone involved has died and someone picks through the scraps.
Why does the Open Group care? (Score:5, Interesting)
Could it be that more people are writing apps for the "unoffical" version because it has more seats than all of the offical Unixes put together? Is everybody just going away from "Unix" and leaving them holding their useless rubber "Unix" stamper? Oops!
Re:Why does the Open Group care? (Score:2, Insightful)
The Open Group are probably put
Re:Why does the Open Group care? (Score:2)
If Linux were the only OS that anyone used, then it would have to fork. One of the driving principles of the open source philosophy is strength through diversity. The way in which this strength is maintained is by standards. Linux conforms to standards, as do the *BSDs and Hurd. This allows you to take the source code from a program written on one system and compile and run it on another.
Contrary to the beliefs of several fanatics, Linux is not
Re: Why does the Open Group care? (Score:3, Funny)
(With apologies to the old "Dude" skit.)
The source of evil (Score:5, Informative)
was the source of some of the headaches VMware has been giving people... (as the BSD implementation of nice(3) follows POSIX).
Code writers: pay close attention to this page if you want to avoid being laughed at by the rest of the world...
Re:The source of evil (Score:2)
Re:The source of evil (Score:2, Informative)
The man page for select on Solaris says that timeout will be mod
Terrific resource for porters (Score:5, Interesting)
It was at least a year after we ported to Linux that I noticed a bug related to the nice() system call. Even more strange, it didn't happen on one of the newer Red Hat Linux test systems. This document could have saved us so much time.
It's times like this I feel smug... (Score:2, Funny)
Of course, there's no hope for me writing something as simple as id or whoami, but still, I can just laugh when people bitch about standards.
Linux and POSIX (Score:2)
I fully endorse the deprecation of gets (it's a truly brain-dead function), but only if it's marked as deprecated and not removed from the system. There are large numbers of (insecure) heavily used programs that use gets() and that are not going to be changed in the near future simple because of tim
Question... (Score:5, Insightful)
Re:Question... (Score:2)
Ask 40 C++ programmers to write the same program, you get 40 completely different architectures. Ok, 38 differenct architectures, and 2 guys in a fistfight about which version of the standard they are going to use.
Now beyond those 2, do you honestly see someone writing an operating system based on:
Re:Question... (Score:2)
Do you even know what an operating system IS?? (Score:2)
> COMMANDMENTS FROM GOD",
To paraphrase Andrew Tannenbaum, an Operating System is a program which hides the details about the hardware and presents a nice interface to the programmer. [well, that's one aspect.. others including scheduling, etc., but aren't relevant to this discussion]
Now, how is that interface presented? Function calls would be handy. What are function calls? They are a standard way of passing parameters to another pie
Re:Question... (Score:2, Insightful)
POSIX predates the standard C library. UNIX and C were developed concurrently. ANSI/ISO C-99 did not exist when the first UNIX was written.
We live in a world where C is no longer the only language used.
Yes, we do now.
Why can't the spec be split into "system stuff" and independent "cross-platform (your favorite language) requirements"?
Not sure what you mean here. The point is that these calls are supposed to work in a cross-platform manne
Re:Question... (Score:2)
Re:Question... (Score:2)
POSIX is expensive (Score:2, Interesting)
POSIX and all those ISO standards, while good I guess, cost a lot of money.
This report on the conflicts seems like an attempt to protect the IP value of the POSIX standards. It wants LSB to reference the POSIX standard or other ISO standards everywhere so that people will feel they need to go buy them.
Free standards to match the freeness of Linux is the way to go.
Linus quote (Score:4, Informative)
As far as I can see the policy seems to be to comply with the POSIX standard as much as possible, except in cases where it is idiotic, in which case it seems reasonable to implement something better, as in the case of threading:
Re:screw POSIX (Score:2, Interesting)
Acme, Inc. has announced that they won't be porting their leading product, Foocreator-4.5, to the Linux platform, CEO John Doe announced today. "The incompatibilities between Unix and Linux are minor, but significant enough that we'd have to review our entire codebase. There may not be a large enough Linux market to justify this effort." he declared today.
Re:Everything Else (Score:4, Insightful)
Re:Everything Else (Score:4, Informative)
XP and Win Server 2003 aren't compliant.The POSIX subsytem was removed in XP and everything after.
Re:Everything Else (Score:5, Informative)
If you want POSIX compatibility under Windows you are better of using Cygwin [cygwin.com] or - at the shell level - the native ports of GNU utilities to Win32 [sourceforge.net]. Add to the mix my Outwit [spinellis.gr] tools for Windows interoperability and you are set.
Diomidis Spinellis - Code Reading: The Open Source Perspective [spinellis.gr]
#include "/dev/tty"
Interoperability (Score:3, Informative)
We'll take your example of RPM. The standard doesn't mean that everyone has to use RPM as their primary package format; they just have to be able to use RP