diff options
Diffstat (limited to 'contrib/bmake/mk')
-rw-r--r-- | contrib/bmake/mk/ChangeLog | 17 | ||||
-rwxr-xr-x[-rw-r--r--] | contrib/bmake/mk/install-mk | 4 | ||||
-rwxr-xr-x | contrib/bmake/mk/meta2deps.py | 28 | ||||
-rwxr-xr-x | contrib/bmake/mk/meta2deps.sh | 14 |
4 files changed, 54 insertions, 9 deletions
diff --git a/contrib/bmake/mk/ChangeLog b/contrib/bmake/mk/ChangeLog index db524d2343b6..fda6d8b02158 100644 --- a/contrib/bmake/mk/ChangeLog +++ b/contrib/bmake/mk/ChangeLog @@ -1,3 +1,20 @@ +2025-07-24 Simon J Gerraty <sjg@beast.crufty.net> + + * install-mk (MK_VERSION): 20250724 + + * meta2deps: Allow X record to have 3 or 4 args. + V4 filemon on Linux produces 3 + V5 filemon on FreeBSD produces 4 + +2025-07-22 Simon J Gerraty <sjg@beast.crufty.net> + + * install-mk (MK_VERSION): 20250721 + + * meta2deps.{py,sh}: detect corrupted filemon output (an issue on + Linux) by checking each record type has the correct number of + words. Throw an error if necessary so that gendirdeps.mk will not + update Makefile.depend + 2025-07-04 Simon J Gerraty <sjg@beast.crufty.net> * prog.mk: .MADE is a special source not a target! diff --git a/contrib/bmake/mk/install-mk b/contrib/bmake/mk/install-mk index 8d354de17cb9..3ed5fd63ee5c 100644..100755 --- a/contrib/bmake/mk/install-mk +++ b/contrib/bmake/mk/install-mk @@ -59,7 +59,7 @@ # Simon J. Gerraty <sjg@crufty.net> # RCSid: -# $Id: install-mk,v 1.266 2025/05/29 01:48:06 sjg Exp $ +# $Id: install-mk,v 1.268 2025/07/24 15:55:48 sjg Exp $ # # @(#) Copyright (c) 1994-2025 Simon J. Gerraty # @@ -74,7 +74,7 @@ # sjg@crufty.net # -MK_VERSION=20250528 +MK_VERSION=20250724 OWNER= GROUP= MODE=444 diff --git a/contrib/bmake/mk/meta2deps.py b/contrib/bmake/mk/meta2deps.py index 70b121003988..77ed86397a0f 100755 --- a/contrib/bmake/mk/meta2deps.py +++ b/contrib/bmake/mk/meta2deps.py @@ -39,7 +39,7 @@ We only pay attention to a subset of the information in the SPDX-License-Identifier: BSD-2-Clause RCSid: - $Id: meta2deps.py,v 1.51 2025/05/16 20:03:43 sjg Exp $ + $Id: meta2deps.py,v 1.54 2025/07/24 16:05:48 sjg Exp $ Copyright (c) 2011-2025, Simon J. Gerraty Copyright (c) 2011-2017, Juniper Networks, Inc. @@ -441,7 +441,7 @@ class MetaFile: # Bye bye We go to some effort to avoid processing a dependency more than once. - Of the above record types only C,E,F,L,R,V and W are of interest. + Of the above record types only C,E,F,L,M,R,V,W and X are of interest. """ version = 0 # unknown @@ -465,8 +465,8 @@ class MetaFile: if self.sb and self.name.startswith(self.sb): error_name = self.name.replace(self.sb+'/','') else: - error_name = self.name - interesting = '#CEFLRVX' + error_name = self.name + interesting = '#CEFLMRVX' for line in f: self.line += 1 # ignore anything we don't care about @@ -475,6 +475,7 @@ class MetaFile: if self.debug > 2: print("input:", line, end=' ', file=self.debug_out) w = line.split() + wlen = len(w) if skip: if w[0] == 'V': @@ -498,6 +499,23 @@ class MetaFile: if line.find('Bye') > 0: eof_token = True continue + else: + # before we go further check we have a sane number of args + # the Linux filemon module is rather unreliable. + if w[0] in 'LM': + elen = 4 + elif w[0] == 'X': + # at least V4 on Linux does 3 args + if wlen == 3: + elen = 3 + else: + elen = 4 + else: + elen = 3 + if self.debug > 2: + print('op={} elen={} wlen={} line="{}"'.format(w[0], elen, wlen, line.strip()), file=self.debug_out) + if wlen != elen: + raise AssertionError('corrupted filemon data: wrong number of words: expected {} got {} in: {}'.format(elen, wlen, line)) pid = int(w[1]) if pid != last_pid: @@ -540,7 +558,7 @@ class MetaFile: print("seen:", w[2], file=self.debug_out) continue # file operations - if w[0] in 'ML': + if w[0] in 'LM': # these are special, tread src as read and # target as write self.parse_path(w[3].strip("'"), cwd, 'W', w) diff --git a/contrib/bmake/mk/meta2deps.sh b/contrib/bmake/mk/meta2deps.sh index e46e5a2e55c1..21c0d0134be5 100755 --- a/contrib/bmake/mk/meta2deps.sh +++ b/contrib/bmake/mk/meta2deps.sh @@ -75,7 +75,7 @@ # RCSid: -# $Id: meta2deps.sh,v 1.22 2025/05/16 20:03:43 sjg Exp $ +# $Id: meta2deps.sh,v 1.24 2025/07/24 15:55:48 sjg Exp $ # SPDX-License-Identifier: BSD-2-Clause # @@ -249,11 +249,21 @@ meta2deps() { ;; *) cat /dev/null "$@";; esac 2> /dev/null | - sed -e 's,^CWD,C C,;/^[#CREFLMVX] /!d' -e "s,',,g" | + sed -e 's,^CWD,C C,;/^[#CREFLMVWX] /!d' -e "s,',,g" | $_excludes | ( version=no epids= xpids= eof_token=no while read op pid path path2 do : op=$op pid=$pid path=$path path2=$path2 + # first a sanity check - filemon on Linux is not very reliable + # path2 should only be non-empty for op L or M + # and it should not contain spaces. + case "$op,$path2" in + \#*) ;; # ok + [LM],) error "missing path2 in: '$op $pid $path'";; + [LMX],*" "*) error "wrong number of words in: '$op $pid $path $path2'";; + *,|[LMX],*) ;; # ok + *) error "wrong number of words in: '$op $pid $path $path2'";; + esac # we track cwd and ldir (of interest) per pid # CWD is bmake's cwd case "$lpid,$pid" in |