Date: Mon, 2 Dec 2019 05:24:17 +0000 (UTC) From: Devin Teske <dteske@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355280 - head/usr.sbin/bsdconfig/share Message-ID: <201912020524.xB25OH8u030206@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dteske Date: Mon Dec 2 05:24:16 2019 New Revision: 355280 URL: https://svnweb.freebsd.org/changeset/base/355280 Log: Fix spurious error from sysrc When using sysrc to modify a file, the file should be created silently. However, with the introduction of SVN r335280, an error of "No such file or directory" would appear despite everything else working as-expected. The nature of this spurious error is that SVN r335280 did not check if the file exists first, before trying to fixup the line-endings in the file just prior to modification. PR: bin/240875 Reported by: Jose Luis Duran MFC after: 3 days Modified: head/usr.sbin/bsdconfig/share/sysrc.subr Modified: head/usr.sbin/bsdconfig/share/sysrc.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/sysrc.subr Mon Dec 2 00:39:58 2019 (r355279) +++ head/usr.sbin/bsdconfig/share/sysrc.subr Mon Dec 2 05:24:16 2019 (r355280) @@ -560,7 +560,7 @@ f_sysrc_set() # if [ "$not_found" ]; then # Add a newline if missing before appending to the file - awk 'BEGIN { wc = 0 } NR == 1 { + [ ! -e "$file" ] || awk 'BEGIN { wc = 0 } NR == 1 { (cmd = "wc -l " FILENAME) | getline close(cmd) wc = $1
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912020524.xB25OH8u030206>