-1

I think that the BSD tools have different flavors, for example the BSD ls tool is not the same tool on FreeBSD and OpenBSD and NetBSD (and even on macOS).

Note that by "different flavors" I mean that they work in a different way (for example: the BSD ls tool on FreeBSD may accept the -A flag, while it may not accept the -A flag on OpenBSD).

But are there multiple flavors of the GNU tools also? for example do the GNU ls and GNU bash and GNU nano tools work exactly the same on all operating systems?

2 Answers 2

2

As I mentioned at https://unix.stackexchange.com/a/506429/5132, Linux-based operating systems do not necessarily use the same programs as one another. There are famously multiple implementations of several fairly basic programs.

These include, but are not limited to:

Notice that this is not variation amongst different GNU tools, strictly speaking. Tools on Linux-based operating systems are not solely from the GNU project. Such operating systems have tools from non-GNU toolsets as well.

Moreover, there is variation amongst Linux-based operating systems when it comes to their having the same toolsets, too. They all build with their own sets of variant local modifications applied. For examples:

  • systemd is built differently on Arch Linux to how it is built on the Debian and Fedora families of Linux-based operating systems. In particular, it is built with the configuration option that says to exclude most (but not all) of the the van Smoorenburg rc compatibility mechanisms. (See https://unix.stackexchange.com/a/389298/5132, https://unix.stackexchange.com/a/451966/5132, and https://unix.stackexchange.com/a/471871/5132.)
  • On Debian Linux, GNU coreutils:
  • On Debian Linux, the Bourne Again shell comes with a (mispackaged) clear_console command that is one of the many mechanisms that force Greg Wooledge (et al.) to clear xyr screen. (See https://unix.stackexchange.com/a/451150/5132.)
  • On Debian Linux and Arch Linux, the native ability of grotty to emit "new" terminal control sequences from ISO 8613-6:1994 and ECMA-48:1976 instead of the (very) old TTY-37 control sequences from 1968, is disabled. Arch Linux also causes single quotes and hyphens to be translated to Latin-1 apostrophe and minus in some circumstances.
  • Different Linux-based operating systems vary according to whether ncurses is "wide" or "narrow".
  • On Debian Linux, the "tiny" version of GNU nano has its menu laid out differently as a result of Debian patches.
  • On Arch Linux, Heirloom/Traditional vi is locally patched in several ways that differentiate it from the original, including a different directory for preserve files and support for editing keypad keys that Bill Joy never had on his ADM-3A terminal (e.g. PgUp and PgDn, see https://vi.stackexchange.com/q/9313/19613).
  • Various Linux-based operating systems configure OpenSSH differently out of the box. Arch Linux, for example, turns ChallengeResponseAuthentication off, PrintMotd off, and UsePAM on. Debian Linux applies an extensive set of patches.

And so on.

Further reading

1
  • note there is als toybox and busybox implementatons Feb 16, 2022 at 2:57
1

The ls utility accepts the -A option on all BSDs. It's a standard POSIX option.

The base BSD tools are developed and maintained by each BSD project independently, but some implementation details are being shared between the projects occasionally (e.g. ways of solving bugs or implementing new features, sometimes even to implement GNU extensions).

The GNU tools, like coreutils, the nano editor, and the bash shell (which is three separate projects) are developed and maintained separately, as their own projects. Divergent implementations are therefore less likely to crop up.

However, there is still a difference between releases of these tools, and you can't generally expect that the bash shell, for example, on one Unix will be exactly the same as on another Unix. Also, modified variants of the GNU tools may occur in some environments, which does not fully support all features, or that supports features not commonly implemented on Linux.

The most obvious example is macOS, which ships with release 3.2 of the bash shell, while the most current release is 5.0.x.

What you can expect, or should expect, is that basic utilities, if they are standard POSIX utilities, should work as the POSIX standard says they should, regardless of whether these are the GNU, BSD or some other implementation of the utilities. Again, this does not include non-standard extensions to these utilities, like any of the "long options" supported by most GNU coreutils utilities, which may or may not be supported in other implementations, and may behave differently depending on the version of the utility.

4
  • Some distributions also have patches that modify the utility behaviours (to fix bugs but also sometimes to add features or revert the behaviour to that of older versions). Different OSes build utilities with different configure options (like Solaris 11 that builds bash with --enable-xpg-echo-default, some distributions that build GNU grep with PCRE support and some without... Mar 23, 2019 at 10:02
  • "The most obvious example is macOS, which ships with release 3.2 of the bash shell, while the most current release is 5.0.x" But can bash on macOS with version 3.2 be different from bash with also version 3.2 on another OS?
    – user343213
    Mar 23, 2019 at 13:02
  • @user343213 The bash shell may be compiled with various defaults, and it may well be compiled with different settings on different Unices. A Unix distributor (like Apple) may also have made changes to the shell to better support extended features on their Unix.
    – Kusalananda
    Mar 23, 2019 at 14:07
  • @user343213, also bash will use the system's regex library for its regexps for instance, so [[ $string =~ $re ]] may work differently from one system to the next if you stray outside of what POSIX specifies for EREs. For instance a=s b='\s' bash -c '[[ $a =~ $b ]]' returns true on FreeBSD and false on Debian, while `a=' ' b='\s' bash -c '[[ $a =~ $b ]]' returns true on Debian and false on FreeBSD Mar 23, 2019 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .