generic/398: remove workarounds for wrong error codes
[xfstests-dev.git] / common / filter
1 ##/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # standard filters
6
7 # Checks that given_value is in range of correct_value +/- tolerance.
8 # Tolerance can be an absolute value or a percentage of the correct value
9 # (see examples with tolerances below).
10 # Outputs suitable message to stdout if it's not in range.
11 #
12 # A verbose option, -v, may be used as the LAST argument
13
14 # e.g. 
15 # foo: 0.0298 = 0.03 +/- 5%
16 # _within_tolerance "foo" 0.0298 0.03 5%  
17
18 # foo: 0.0298 = 0.03 +/- 0.01
19 # _within_tolerance "foo" 0.0298 0.03 0.01
20 #
21 # foo: 0.0298 = 0.03 -0.01 +0.002
22 # _within_tolerance "foo" 0.0298 0.03 0.01 0.002
23 #
24 # foo: verbose output of 0.0298 = 0.03 +/- 5% 
25 # _within_tolerance "foo" 0.0298 0.03 5% -v 
26 _within_tolerance()
27 {
28   _name=$1
29   _given_val=$2
30   _correct_val=$3
31   _mintol=$4
32   _maxtol=$_mintol
33   _verbose=0
34   _debug=false
35
36   # maxtol arg is optional
37   # verbose arg is optional
38   if [ $# -ge 5 ]
39   then 
40      if [ "$5" = "-v" ]
41      then
42         _verbose=1
43      else
44         _maxtol=$5
45      fi
46   fi
47   if [ $# -ge 6 ]
48   then
49      [ "$6" = "-v" ] && _verbose=1
50   fi
51
52   # find min with or without %
53   _mintolerance=`echo $_mintol | sed -e 's/%//'` 
54   if [ $_mintol = $_mintolerance ]
55   then 
56       _min=`echo "scale=5; $_correct_val-$_mintolerance" | bc`
57   else
58       _min=`echo "scale=5; $_correct_val-$_mintolerance*0.01*$_correct_val" | bc`
59   fi
60
61   # find max with or without %
62   _maxtolerance=`echo $_maxtol | sed -e 's/%//'` 
63   if [ $_maxtol = $_maxtolerance ]
64   then 
65       _max=`echo "scale=5; $_correct_val+$_maxtolerance" | bc`
66   else
67       _max=`echo "scale=5; $_correct_val+$_maxtolerance*0.01*$_correct_val" | bc`
68   fi
69
70   $_debug && echo "min = $_min"
71   $_debug && echo "max = $_max"
72
73   cat <<EOF >$tmp.bc.1
74 scale=5;
75 if ($_min <= $_given_val) 1;
76 if ($_min > $_given_val) 0; 
77 EOF
78
79   cat <<EOF >$tmp.bc.2
80 scale=5;
81 if ($_given_val <= $_max) 1;
82 if ($_given_val > $_max) 0;
83 EOF
84
85   _above_min=`bc <$tmp.bc.1`
86   _below_max=`bc <$tmp.bc.2`
87
88   rm -f $tmp.bc.[12]
89
90   _in_range=`expr $_above_min \& $_below_max` 
91
92   # fix up min, max precision for output
93   # can vary for 5.3, 6.2
94
95   # remove any trailing zeroes from min, max if they have fractional parts
96   _min=`echo $_min | sed -e '/\./s/0*$//' -e 's/\.$//'`
97   _max=`echo $_max | sed -e '/\./s/0*$//' -e 's/\.$//'`
98
99   if [ $_in_range -eq 1 ] 
100   then
101         [ $_verbose -eq 1 ] && echo $_name is in range
102         return 0
103   else
104         [ $_verbose -eq 1 ] && echo $_name has value of $_given_val
105         [ $_verbose -eq 1 ] && echo $_name is NOT in range $_min .. $_max       
106         return 1
107   fi
108 }
109
110 # ctime(3) dates
111 #
112 _filter_date()
113 {
114     sed \
115         -e 's/[A-Z][a-z][a-z] [A-z][a-z][a-z]  *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/'
116 }
117
118 # prints filtered output on stdout, values (use eval) on stderr
119 # Non XFS filesystems always return a 4k block size and a 256 byte inode.
120 _filter_mkfs()
121 {
122     case $FSTYP in
123     xfs)
124         ;;
125     *)
126         cat - >/dev/null
127         perl -e 'print STDERR "dbsize=4096\nisize=256\n"'
128         return ;;
129     esac
130
131     echo "_fs_has_crcs=0" >&2
132     set -
133     perl -ne '
134     if (/^meta-data=([\w,|\/.-]+)\s+isize=(\d+)\s+agcount=(\d+), agsize=(\d+) blks/) {
135         print STDERR "ddev=$1\nisize=$2\nagcount=$3\nagsize=$4\n";
136         print STDOUT "meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks\n";
137     }
138     if (/^\s+=\s+sectsz=(\d+)\s+attr=(\d+)/) {
139         print STDERR "sectsz=$1\nattr=$2\n";
140     }
141     if (/^\s+=\s+crc=(\d)/) {
142         print STDERR "_fs_has_crcs=$1\n";
143     }
144     if (/^data\s+=\s+bsize=(\d+)\s+blocks=(\d+), imaxpct=(\d+)/) {
145         print STDERR "dbsize=$1\ndblocks=$2\nimaxpct=$3\n";
146         print STDOUT "data     = bsize=XXX blocks=XXX, imaxpct=PCT\n";
147     }
148     if (/^\s+=\s+sunit=(\d+)\s+swidth=(\d+) blks/) {
149         print STDERR "sunit=$1\nswidth=$2\nunwritten=1\n";
150         print STDOUT "         = sunit=XXX swidth=XXX, unwritten=X\n";
151     }
152     if (/^naming\s+=version\s+(\d+)\s+bsize=(\d+)/) {
153         print STDERR "dirversion=$1\ndirbsize=$2\n";
154         print STDOUT "naming   =VERN bsize=XXX\n";
155     }
156     if (/^log\s+=(internal log|[\w|\/.-]+)\s+bsize=(\d+)\s+blocks=(\d+),\s+version=(\d+)/ ||
157         /^log\s+=(internal log|[\w|\/.-]+)\s+bsize=(\d+)\s+blocks=(\d+)/) {
158         print STDERR "ldev=\"$1\"\nlbsize=$2\nlblocks=$3\nlversion=$4\n";
159         print STDOUT "log      =LDEV bsize=XXX blocks=XXX\n";
160     }
161     if (/^\s+=\s+sectsz=(\d+)\s+sunit=(\d+) blks/) {
162         print STDERR "logsectsz=$1\nlogsunit=$2\n\n";
163     }
164     if (/^realtime\s+=([\w|\/.-]+)\s+extsz=(\d+)\s+blocks=(\d+), rtextents=(\d+)/) {
165         print STDERR "rtdev=$1\nrtextsz=$2\nrtblocks=$3\nrtextents=$4\n";
166         print STDOUT "realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX\n";
167     }'
168 }
169
170
171 # prints the bits we care about in growfs
172
173 _filter_growfs()
174 {
175     perl -ne '
176     if (/^data\s+=\s+bsize=(\d+)\s+blocks=(\d+), imaxpct=(\d+)/) {
177         print "xfs_growfs --BlockSize=$1 --Blocks=$2\n";
178     }
179     elsif (/^data/) {
180         print;
181     }'
182 }
183
184 _filter_dd()
185 {
186     $AWK_PROG '
187         /records in/                { next }
188         /records out/               { next }
189         /No space left on device/   { print "   !!! disk full (expected)" 
190                                       next }
191                                     { print "   *** " $0 }
192     '
193 }
194
195 common_line_filter()
196 {
197     perl -ne 'if (/.*:(.*)/) {
198         if ( "$last_line" ne "$1" ) { print "$_"; $first_match=1; }
199         elsif ( $first_match==1 ) { print "*\n"; $first_match=0; }
200         $last_line="$1";
201     }
202     else {
203         print $_; $last_line=$_;
204     }'
205 }
206
207 _filter_xfs_io()
208 {
209     # Apart from standard numeric values, we also filter out 'inf' and 'nan'
210     # which can result from division in some cases
211     sed -e "s/[0-9/.]* [GMKiBbytes]*, [0-9]* ops\; [0-9/:. sec]* ([infa0-9/.]* [EPGMKiBbytes]*\/sec and [infa0-9/.]* ops\/sec)/XXX Bytes, X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"
212 }
213
214 # Also filter out the offset part of xfs_io output
215 # Some test cases may be affected by underlaying extent/chunk layout change,
216 # so wipe out this part to avoid golden output difference
217 _filter_xfs_io_offset()
218 {
219     # filter out " at offset XXX" and offset of "pread -v"
220     _filter_xfs_io | sed -e "s/ at offset [0-9]*$//" -e "s/^[0-9a-f]\+:/XXXXXXXX:/"
221 }
222
223 # stderr filter for xfs_io to handle change of error output format (e.g.
224 # pwrite64 -> pwrite).
225 _filter_xfs_io_error()
226 {
227         sed -e "s/^\(.*\)64\(: .*$\)/\1\2/"
228 }
229
230 _filter_xfs_io_unique()
231 {
232     common_line_filter | _filter_xfs_io
233 }
234
235 _filter_xfs_io_units_modified()
236 {
237         UNIT=$1
238         UNIT_SIZE=$2
239
240         $AWK_PROG -v unit="$UNIT" -v unit_size=$UNIT_SIZE '
241                 /wrote/ {
242                         split($2, bytes, "/")
243
244                         bytes_written = strtonum(bytes[1])
245
246                         offset = strtonum($NF)
247
248                         unit_start = offset / unit_size
249                         unit_start = int(unit_start)
250                         unit_end = (offset + bytes_written - 1) / unit_size
251                         unit_end = int(unit_end)
252
253                         printf("%ss modified: [%d - %d]\n", unit, unit_start, unit_end)
254
255                         next
256                 }
257         '
258 }
259
260 _filter_xfs_io_blocks_modified()
261 {
262         BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT)
263
264         _filter_xfs_io_units_modified "Block" $BLOCK_SIZE
265 }
266
267 _filter_xfs_io_pages_modified()
268 {
269         PAGE_SIZE=$(get_page_size)
270
271         _filter_xfs_io_units_modified "Page" $PAGE_SIZE
272 }
273
274 _filter_xfs_io_numbers()
275 {
276         _filter_xfs_io | sed -E 's/[0-9]+/XXXX/g'
277 }
278
279 _filter_test_dir()
280 {
281         # TEST_DEV may be a prefix of TEST_DIR (e.g. /mnt, /mnt/ovl-mnt)
282         # so substitute TEST_DIR first
283         sed -e "s,\B$TEST_DIR,TEST_DIR,g" \
284             -e "s,\B$TEST_DEV,TEST_DEV,g"
285 }
286
287 _filter_scratch()
288 {
289         # SCRATCH_DEV may be a prefix of SCRATCH_MNT (e.g. /mnt, /mnt/ovl-mnt)
290         # so substitute SCRATCH_MNT first
291         sed -e "s,\B$SCRATCH_MNT,SCRATCH_MNT,g" \
292             -e "s,\B$SCRATCH_DEV,SCRATCH_DEV,g" \
293             -e "/.use_space/d"
294 }
295
296 _filter_testdir_and_scratch()
297 {
298         # filter both $TEST_DIR and $SCRATCH_MNT, but always filter the longer
299         # string first if the other string is a substring of the first one
300         if echo "$TEST_DIR" | grep -q "$SCRATCH_MNT"; then
301                 _filter_test_dir | _filter_scratch
302         else
303                 _filter_scratch | _filter_test_dir
304         fi
305 }
306
307 # Turn any device in the scratch pool into SCRATCH_DEV
308 _filter_scratch_pool()
309 {
310         FILTER_STRINGS=`echo $SCRATCH_DEV_POOL | sed -e 's/\s\+/\\\|/g'`
311         sed -e "s,$FILTER_STRINGS,SCRATCH_DEV,g"
312 }
313
314 _filter_spaces()
315 {
316         sed -e "s/\s\+/ /g"
317 }
318
319 _filter_quota()
320 {
321         # Long dev name might be split onto its own line; last
322         # seds remove that newline if present
323         _filter_testdir_and_scratch | _filter_spaces | \
324         sed -e 'N;s/SCRATCH_DEV\n/SCRATCH_DEV/g' | \
325         sed -e 'N;s/TEST_DEV\n/TEST_DEV/g'
326 }
327
328 _filter_project_quota()
329 {
330         # Project ID 0 is always present on disk but was not reported
331         # until the GETNEXTQUOTA ioctl came into use.  Filter it out.
332         # But if you specify a name for ID 0, that means you want to
333         # deal with it by yourself, this function won't filter it out.
334         _filter_quota | grep -v "^\#0 \|^(null) "
335 }
336
337 # Account for different "ln" failure messages
338 _filter_ln()
339 {
340         sed -e "s,\(creating symbolic link .*\) to .*: ,\1: ," \
341             -e "s,failed to create,creating,"
342 }
343
344 # If given an arg, filter *that* UUID string
345 # Otherwise look for something that looks like a generic UUID
346 _filter_uuid()
347 {
348         if [ ! -z $1 ]; then
349                 UUID=$1
350                 sed -e "s/\(uuid[ :=]\+\) $UUID/\1 <EXACTUUID>/i"
351         else
352                 sed -e "s/\(uuid[ :=]\+\) [0-9a-f-][0-9a-f-]*/\1 <UUID>/ig"
353         fi
354 }
355
356 # In mixed group the added disks may have zero used size
357 _filter_zero_size()
358 {
359         sed -e "s/0\.00/<SIZE>/g"
360 }
361
362 # Filter out sizes like 6.14MB etc
363 _filter_size()
364 {
365         sed -e "s/[0-9\.]\+\s\?[b|k|m|g|t][i]\?[b]\?/<SIZE>/ig"
366 }
367
368 # Convert string read from stdin like 128K to bytes and print it to stdout
369 _filter_size_to_bytes()
370 {
371         read size
372         suffix=${size:${#size}-1}
373         mul=1
374         case $suffix in
375                 k|K) mul=1024 ;;
376                 m|M) mul=$((1024*1024)) ;;
377                 g|G) mul=$((1024*1024*1024)) ;;
378                 t|T) mul=$((1024*1024*1024*1024)) ;;
379         esac
380         echo $((${size:0:${#size}-1}*$mul))
381 }
382
383 # Print trimmed bytes of fstrim
384 # Starting from util-linux v2.23 fstrim usees human readable sizes in
385 # verbose output
386 _filter_fstrim()
387 {
388         egrep -o "[0-9]+ bytes" | $AWK_PROG '{print $1}'
389 }
390
391 # Remove the ending dot appended to mount error message, util-linux 2.30
392 # starts to do so.
393 _filter_ending_dot()
394 {
395         sed -e "s/\.$//"
396 }
397
398 # Older mount output referred to "block device" when mounting RO devices. It's
399 # gone in newer versions. v2.30 changed the output again. This filter is to
400 # unify all read-only mount messages across all util-linux versions.
401 #
402 # for a successful ro mount:
403 # ancient:         mount: block device <device> is write-protected, mounting read-only
404 # prior to v2.30:  mount: <device> is write-protected, mounting read-only
405 # v2.30 and later: mount: <mountpoint>: WARNING: device write-protected, mounted read-only.
406 #
407 # a failed ro mount:
408 # ancient (two-line message):
409 # mount: block device <device> is write-protected, mounting read-only
410 # mount: cannot mount block device <device> read-only
411 # prior to v2.30 (two-line message):
412 # mount: <device> is write-protected, mounting read-only
413 # mount: cannot mount <device> read-only
414 # v2.30 and later (single-line message):
415 # mount: <mountpoint>: cannot mount <device> read-only.
416 #
417 # a failed rw remount:
418 # ancient:         mount: cannot remount block device <device> read-write, is write-protected
419 # prior to v2.30:  mount: cannot remount <device> read-write, is write-protected
420 # v2.30 and later: mount: <mountpoint>: cannot remount <device> read-write, is write-protected.
421 #
422 # Now use _filter_ro_mount to unify all these differences across old & new
423 # util-linux versions. So the filtered format would be:
424 #
425 # successful ro mount:
426 # mount: device write-protected, mounting read-only
427 #
428 # failed ro mount:
429 # mount: device write-protected, mounting read-only
430 # mount: cannot mount device read-only
431 #
432 # failed rw remount:
433 # mount: cannot remount device read-write, is write-protected
434 _filter_ro_mount() {
435         perl -ne '
436         if (/write-protected, mount.*read-only/) {
437                 # filter successful ro mount, and first line of prior to v2.30
438                 # format failed ro mount
439                 print "mount: device write-protected, mounting read-only\n";
440         } elsif (/mount: .*: cannot mount.*read-only/) {
441                 # filter v2.30 format failed ro mount, convert single-line
442                 # message to two-line message
443                 print "mount: device write-protected, mounting read-only\n";
444                 print "mount: cannot mount device read-only\n";
445         } elsif (/^mount: cannot mount .* read-only$/) {
446                 # filter prior to v2.30 format failed ro mount
447                 print "mount: cannot mount device read-only\n";
448         } elsif (/mount:.* cannot remount .* read-write.*/) {
449                 # filter failed rw remount
450                 print "mount: cannot remount device read-write, is write-protected\n";
451         } else {
452                 print "$_";
453         }' | _filter_ending_dot
454 }
455
456 # Filter a failed mount output due to EUCLEAN and USTALE, util-linux changed
457 # the message several times.
458 #
459 # prior to v2.21:
460 # mount: Structure needs cleaning
461 # v2.21 to v2.29:
462 # mount: mount <device> on <mountpoint> failed: Structure needs cleaning
463 # v2.30 and later:
464 # mount: <mountpoint>: mount(2) system call failed: Structure needs cleaning.
465 #
466 # This is also true for ESTALE error. So let's remove all the changing parts
467 # and keep the 'prior to v2.21' format:
468 # mount: Structure needs cleaning
469 # mount: Stale file handle
470 _filter_error_mount()
471 {
472         sed -e "s/mount:\(.*failed:\)/mount:/" | _filter_ending_dot
473 }
474
475 # Similar to _filter_error_mount, filter a busy mount output.
476 # Turn both old (prior to util-linux v2.30) and new (v2.30 and later) format to
477 # a simple one. e.g.
478 # old: mount: <device> is already mounted or <mountpoint> busy
479 # new: mount: <mountpoint>: <device> already mounted or mount point busy.
480 # filtered: mount: device already mounted or mount point busy
481 _filter_busy_mount()
482 {
483         sed -e "s/.*: .* already mounted or .* busy/mount: device already mounted or mount point busy/" | \
484                 _filter_ending_dot
485 }
486
487 _filter_od()
488 {
489         BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT)
490         $AWK_PROG -v block_size=$BLOCK_SIZE '
491                 /^[0-9]+/ {
492                         offset = strtonum("0"$1);
493                         $1 = sprintf("%o", offset / block_size);
494                         print $0;
495                 }
496                 /\*/
497         '
498 }
499
500 # Remove quotes from failed mknod calls. Starting with Coreutils v8.25,
501 # mknod errors print unquoted filenames
502 _filter_mknod()
503 {
504         sed -e "s/mknod: [\`']\(.*\)': File exists/mknod: \1: File exists/"
505 }
506
507 # Remove leading "rename" in "mv -v" output
508 _filter_mv()
509 {
510         sed -e "s/^renamed //"
511 }
512
513 _filter_lostfound()
514 {
515         sed -e '/^lost+found$/d'
516 }
517
518 _filter_ovl_dirs()
519 {
520         sed -e "s,$OVL_LOWER,OVL_LOWER,g" \
521             -e "s,$OVL_UPPER,OVL_UPPER,g" \
522             -e "s,$OVL_WORK,OVL_WORK,g"
523 }
524
525 # interpret filefrag output,
526 # eg. "physical 1234, length 10, logical 5678" -> "1234#10#5678"
527 _filter_filefrag()
528 {
529         perl -ne '
530         if (/blocks? of (\d+) bytes/) {
531                 $blocksize = $1;
532                 next
533         }
534         ($ext, $logical, $physical, $length) =
535                 (/^\s*(\d+):\s+(\d+)..\s+\d+:\s+(\d+)..\s+\d+:\s+(\d+):/)
536         or next;
537         ($flags) = /.*:\s*(\S*)$/;
538         print $physical * $blocksize, "#",
539               $length * $blocksize, "#",
540               $logical * $blocksize, "#",
541               $flags, "\n"'
542 }
543
544 # Clean up the extents list output of 'xfs_io -c fiemap', e.g.
545 #
546 #       file:
547 #               0: [0..79]: 628365312..628365391
548 #               1: [80..159]: hole
549 #               2: [160..319]: 628365472..628365631
550 # =>
551 #       0  79   628365312  628365391
552 #       160  319   628365472  628365631
553 #
554 # The fields are:
555 #
556 #       first_logical_block last_logical_block first_physical_block last_physical_block
557 #
558 # Blocks are 512 bytes, and holes are omitted.
559 #
560 _filter_xfs_io_fiemap()
561 {
562          grep -E '^[[:space:]]+[0-9]+:' \
563                  | grep -v '\<hole\>' \
564                  | sed -E 's/^[[:space:]]+[0-9]+://' \
565                  | tr '][.:' ' '
566 }
567
568 # We generate WARNINGs on purpose when applications mix buffered/mmap IO with
569 # direct IO on the same file. This is a helper for _check_dmesg() to filter out
570 # such warnings.
571 _filter_aiodio_dmesg()
572 {
573         local warn1="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_write.*"
574         local warn2="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_read.*"
575         local warn3="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_read_iter.*"
576         local warn4="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_aio_read.*"
577         local warn5="WARNING:.*fs/iomap\.c:.*iomap_dio_rw.*"
578         local warn6="WARNING:.*fs/xfs/xfs_aops\.c:.*__xfs_get_blocks.*"
579         local warn7="WARNING:.*fs/iomap\.c:.*iomap_dio_actor.*"
580         local warn8="WARNING:.*fs/iomap\.c:.*iomap_dio_complete.*"
581         local warn9="WARNING:.*fs/direct-io\.c:.*dio_complete.*"
582         local warn10="WARNING:.*fs/iomap/direct-io\.c:.*iomap_dio_actor.*"
583         sed -e "s#$warn1#Intentional warnings in xfs_file_dio_aio_write#" \
584             -e "s#$warn2#Intentional warnings in xfs_file_dio_aio_read#" \
585             -e "s#$warn3#Intentional warnings in xfs_file_read_iter#" \
586             -e "s#$warn4#Intentional warnings in xfs_file_aio_read#" \
587             -e "s#$warn5#Intentional warnings in iomap_dio_rw#" \
588             -e "s#$warn6#Intentional warnings in __xfs_get_blocks#" \
589             -e "s#$warn7#Intentional warnings in iomap_dio_actor#" \
590             -e "s#$warn8#Intentional warnings in iomap_dio_complete#" \
591             -e "s#$warn9#Intentional warnings in dio_complete#" \
592             -e "s#$warn10#Intentional warnings in iomap_dio_actor#"
593 }
594
595 # We generate assert related WARNINGs on purpose and make sure test doesn't fail
596 # because of these warnings. This is a helper for _check_dmesg() to filter out
597 # them.
598 _filter_assert_dmesg()
599 {
600         local warn1="WARNING:.*fs/xfs/xfs_message\.c:.*asswarn.*"
601         local warn2="WARNING:.*fs/xfs/xfs_message\.c:.*assfail.*"
602         sed -e "s#$warn1#Intentional warnings in asswarn#" \
603             -e "s#$warn2#Intentional warnings in assfail#"
604 }
605
606 # With version 2.41 of libcap, the output format of getcap changed.
607 # More specifically such change was added by the following commit:
608 #
609 # commit 177cd418031b1acfcf73fe3b1af9f3279828681c
610 # Author: Andrew G. Morgan <morgan@kernel.org>
611 # Date:   Tue Jul 21 22:58:05 2020 -0700
612 #
613 #     A more compact form for the text representation of capabilities.
614 #
615 #     While this does not change anything about the supported range of
616 #     equivalent text specifications for capabilities, as accepted by
617 #     cap_from_text(), this does alter the preferred output format of
618 #     cap_to_text() to be two characters shorter in most cases. That is,
619 #     what used to be summarized as:
620 #
621 #        "= cap_foo+..."
622 #
623 #     is now converted to the equivalent text:
624 #
625 #        "cap_foo=..."
626 #
627 #     which is also more intuitive.
628 #
629 _filter_getcap()
630 {
631         sed -e "s/= //" -e "s/\+/=/g"
632 }
633
634 # make sure this script returns success
635 /bin/true