Page MenuHomeFreeBSD

sh.1: Document which features are non-POSIX
Needs ReviewPublic

Authored by tembun_bk.ru on Tue, Feb 17, 5:33 PM.
Referenced Files
F145620720: D55333.id.diff
Sun, Feb 22, 7:03 AM
Unknown Object (File)
Sat, Feb 21, 1:49 AM
Unknown Object (File)
Fri, Feb 20, 4:22 PM
Unknown Object (File)
Wed, Feb 18, 5:10 AM
Unknown Object (File)
Wed, Feb 18, 3:47 AM
Unknown Object (File)
Tue, Feb 17, 10:59 PM
Subscribers

Details

Summary

Since /bin/sh follows the POSIX standard quite closely, I think it would make sense to point out which features are non-POSIX and thus can not be safely assumed to be portable and exist in every shell implementation.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

bin/sh/sh.1
86

I suspect that in this case .St is not necessary?

327

Just for the consistency. As I can see, man pages use 'non-standard' more often than 'nonstandard':

$ grep -i 'nonstandard' $(find . -type f -name "*.[1-9]") |wc -l
15
$ grep -i 'non-standard' $(find . -type f -name "*.[1-9]") |wc -l
142
1177

I'm not sure that it is the best way to incorporate this information, but to me it seems quite natural, I think in cases where it can be done, it's better than a standalone sentence.

2824

Maybe other suggestions how to write it better?

emaste added inline comments.
bin/sh/sh.1
327

wiktionary tells me nonstandard is more common in American English, non-standard is more common in British English.

1177

"a non-standard local command" could be read as if there is a choice of local commands, one standard and one non-standard. "the non-standard local command" seems OK to me.

bin/sh/sh.1
327

Alright, according to this guideline, we should prefer American English variant. I would change 'behaviour' to 'behavior' then too.

tembun_bk.ru marked 2 inline comments as done.

Grammar improvements:

  • Prefer American English: 'non-standard' -> 'nonstandard', 'behaviour' -> 'behavior'.
  • 'a nonstandard local command' -> 'the nonstandard local command'.
ziaee requested changes to this revision.Wed, Feb 18, 6:15 PM

I absolutely love the base premise of what you're trying to do here. This will be a major accessibility win for the faction which supports promoting portable programming, which FreeBSD is one of the main champions of.

Standard means too many different things in too many different contexts. The term "non-posix" seems popular:

$ git grep -i "non-posix"
bin/sh/tests/builtins/local1.0:# A commonly used but non-POSIX builtin.
bin/sh/tests/execution/shellproc7.0:# Non-POSIX trickery that is widely supported,
cddl/contrib/opensolaris/head/synch.h: * non-posix symbols/constants violating the namespace restrictions.  Hence,
contrib/bc/gen/bc_help.txt:      Error if any non-POSIX extensions are used.
contrib/bc/gen/bc_help.txt:      Warn if any non-POSIX extensions are used.
contrib/bc/gen/bc_help.txt:      Error if any non-POSIX extensions are used.
contrib/bc/include/status.h:	/// Non-POSIX comment used error.
contrib/bc/include/status.h:	/// Non-POSIX keyword error.
contrib/bc/include/status.h:	/// Non-POSIX . (last) error.
contrib/bc/include/status.h:	/// Non-POSIX return error.
contrib/bc/include/status.h:	/// Non-POSIX boolean operator used error.
contrib/bc/include/status.h:	/// Non-POSIX exponential (scientific or engineering) number used error.
contrib/bc/include/status.h:	/// Non-POSIX array reference error.
contrib/bc/include/status.h:	/// Non-POSIX void error.
contrib/bc/include/status.h:	/// Non-POSIX brace position used error.
contrib/bc/src/bc_lex.c:			// ensure that only non-POSIX keywords get redefined.
contrib/bc/src/bc_parse.c:			// If we are allowed non-POSIX stuff...
contrib/byacc/CHANGES:	relied upon non-POSIX behavior.
contrib/byacc/CHANGES:		use sed to work around non-POSIX tail utility
contrib/byacc/aclocal.m4:dnl without losing the common non-POSIX features.
contrib/dialog/CHANGES:	  + use $SHELL consistently, deprecate non-POSIX shell
contrib/dialog/aclocal.m4:dnl without losing the common non-POSIX features.
contrib/diff/ChangeLog:	The following changes simplify porting to non-Posix environments.
contrib/diff/NEWS:* New diff option: --binary (useful only on non-POSIX hosts)
contrib/elftoolchain/nm/nm.c:	 * In non-POSIX mode, the option is a synonym for the '-A' and
contrib/flex/ChangeLog:	reformat a list of non-posix features
contrib/libarchive/NEWS:Jan 30, 2008: Ignore hardlink size for non-POSIX tar archives.
contrib/libarchive/libarchive/archive_read_support_format_tar.c:				a->archive.archive_format_name = "tar (non-POSIX)";
contrib/libarchive/libarchive/archive_write_set_format_v7tar.c:	a->format_name = "tar (non-POSIX)";
contrib/libarchive/libarchive/archive_write_set_format_v7tar.c:	a->archive.archive_format_name = "tar (non-POSIX)";
contrib/libevent/configure:# libraries is broken (non-POSIX).
contrib/libevent/m4/acx_pthread.m4:# libraries is broken (non-POSIX).
contrib/libpcap/ftmacros.h: * to make non-POSIX APIs that we use unavailable.
contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_allocator_checks.h:// and a bit relaxed requirement for non-POSIX ones, that the size is a multiple
contrib/llvm-project/llvm/lib/Support/StringRef.cpp:// strncasecmp() is not available on non-POSIX systems, so define an
contrib/lua/doc/manual.html:On non-POSIX systems,
contrib/lua/doc/manual.html:On non-POSIX systems,
contrib/ncurses/NEWS:	+ modify configure script to avoid conflict with a non-POSIX feature
contrib/ncurses/NEWS:	+ build-fix for Solaris, whose /bin/sh and /usr/bin/sed are non-POSIX.
contrib/ncurses/NEWS:	  non-POSIX systems (discussion with Stanislav Ievlev).
contrib/ncurses/aclocal.m4:dnl a few others (i.e., GNU make and the non-POSIX "BSD" make):
contrib/ncurses/aclocal.m4:dnl without losing the common non-POSIX features.
contrib/ncurses/doc/hackguide.doc:   This modules assist in POSIX emulation on non-POSIX systems:
contrib/ncurses/ncurses/SigAction.h: * This file exists to handle non-POSIX systems which don't have <unistd.h>,
contrib/ntp/sntp/libevent/configure:# libraries is broken (non-POSIX).
contrib/ntp/sntp/libevent/m4/acx_pthread.m4:# libraries is broken (non-POSIX).
contrib/ntp/sntp/m4/openldap.m4:[AC_CACHE_CHECK([non-posix strerror_r],ol_cv_nonposix_strerror_r,[
contrib/sendmail/RELEASE_NOTES:	On some non-Posix systems, the decision of whether chown(2) permits
contrib/sendmail/src/conf.c:**  SETSID -- set session id (for non-POSIX systems)
contrib/tcpdump/ftmacros.h: * to make non-POSIX APIs that we use unavailable.
contrib/tcsh/tcsh.man:the test will succeed in a POSIX shell but fail in a non-POSIX shell.
contrib/tcsh/tcsh.man.new:the test will succeed in a POSIX shell but fail in a non-POSIX shell.
contrib/tzcode/NEWS:    non-POSIX hosts where malloc doesn't set errno.
contrib/tzdata/NEWS:    -DHAVE_STRUCT_TIMESPEC=0 port to non-POSIX.1-2008 platforms
contrib/tzdata/NEWS:    non-POSIX hosts where malloc doesn't set errno.
contrib/unbound/ax_pthread.m4:# libraries is broken (non-POSIX).
contrib/unbound/configure:# libraries is broken (non-POSIX).
contrib/xz/ChangeLog:        and aren't needed on non-POSIX systems.
contrib/xz/src/xz/util.h:/// This function exists, because non-POSIX systems don't support thousand
contrib/xz/src/xz/xz.1:This feature is not available on non-POSIX systems.
crypto/krb5/src/config/ac-archive/ax_pthread.m4:# libraries is broken (non-POSIX).
crypto/krb5/src/configure:# libraries is broken (non-POSIX).
crypto/openssh/openbsd-compat/fnmatch.c: * Notably, non-POSIX locales with FNM_CASEFOLD produce undefined results,
crypto/openssh/openbsd-compat/fnmatch.c: * and non-POSIX locale collation orders; requires mbr* APIs to track shift
crypto/openssh/openbsd-compat/sigact.h: * This file exists to handle non-POSIX systems which don't have <unistd.h>,
include/pthread_np.h: * Non-POSIX thread function prototype definitions:
include/xlocale/_wchar.h: * Only declare the non-POSIX functions if we're included from xlocale.h.
lib/libc/locale/collate.c: * In the non-POSIX case, we transform each character into a string of
lib/libc/posix1e/acl_get.c: * acl_get_fd_np - syscall wrapper for retrieving ACL by fd (non-POSIX)
lib/libc/posix1e/acl_get.c: *                   (non-POSIX)
lib/libc/posix1e/acl_get.c: *                   permset (non-POSIX)
lib/libc/posix1e/acl_to_text.c: * a non-POSIX.1e semantics ACL.
lib/libthr/thread/thr_single_np.c:	/* Enter single-threaded (non-POSIX) scheduling mode: */
sbin/hastd/lzf.c:   * bit pattern traps. Since the only platform that is both non-POSIX
share/mk/sys.mk:# non-Posix rule set
sys/cddl/contrib/opensolaris/uts/common/sys/synch.h: * non-posix symbols/constants, violating POSIX namespace restrictions.  Hence,
sys/contrib/libsodium/m4/ax_pthread.m4:# libraries is broken (non-POSIX).
sys/contrib/openzfs/lib/libspl/include/umem.h: * with non-POSIX platforms that require a different free
sys/contrib/openzfs/man/man1/cstyle.1:Check for use of non-POSIX types.
sys/contrib/openzfs/scripts/cstyle.pl:	-P	check for use of non-POSIX types
sys/contrib/openzfs/scripts/cstyle.pl:		# try to detect old non-POSIX types.
sys/contrib/openzfs/scripts/cstyle.pl:			err("non-POSIX typedef $1 used: use $old2posix{$1} instead");
sys/contrib/zstd/programs/platform.h:*  PLATFORM_POSIX_VERSION = 1 for Unix-like but non-POSIX
sys/security/audit/audit_bsm.c:	/* shm_rename is a non-Posix extension to the Posix shm implementation */
sys/sys/mac.h: * Extended non-POSIX.1e interfaces that offer additional services available
bin/sh/sh.1
86

Don't add this, instead fix the stale and contradictory statement on lines 80,82. That's how you keep the text down. More text requires more clever beans to process.

This revision now requires changes to proceed.Wed, Feb 18, 6:15 PM
bin/sh/sh.1
86

Do you have any ideas on how to change the 80-82 sentence? To me it seems that if I would try to 'join' thoughts on 80-82 and 85-86, the result would be too overloaded. I don't mind removing 80-82 and using 85-86 instead, but that's only my opinion, maybe we shouldn't completely remove it.

Change 'nonstandard' -> 'non-POSIX'.

tembun_bk.ru retitled this revision from sh.1: Document which features are non-standard to sh.1: Document which features are non-POSIX.Wed, Feb 18, 7:26 PM
tembun_bk.ru edited the summary of this revision. (Show Details)