Commit Graph

6573 Commits

Author SHA1 Message Date
8d00c56663 ci: extend error diagnostics when configure invocation fails
* ci/run-build-and-tests.sh: Include $CC -dumpspecs output in addition
to config.log when ./configure fails.
2018-03-13 15:12:14 +00:00
8c00b612e5 ci: rename travis-build.sh and travis-install.sh scripts
* travis-build.sh: Rename to ci/run-build-and-tests.sh, all callers
updated.
* travis-install.sh: Rename to ci/install-dependencies.sh, all callers
updated.
2018-03-13 13:19:02 +00:00
3de1462ed8 tests: extend ioctl.test libc protection to -y output
* tests/ioctl.test: Extend the filter of ioctl calls with standard
descriptor arguments to -y output.
2018-03-13 01:53:04 +00:00
Harsha Sharma
babc639416 ptp.c: print field names and use macros form print_fields.h
* ptp.c: Include "print_fields.h".
(ptp_ioctl): Print field names with field values for PTP_PEROUT_REQUEST,
use macros from print_fields.h.
2018-03-12 13:52:32 +00:00
Chen Jingpiao
8932ac050e tests: add check for decoding of netfilter subsystem
* tests/netlink_netfilter.c(test_nfgenmsg): Add check for decoding
of netfilter subsystem.
2018-03-11 15:35:19 +00:00
Chen Jingpiao
073d93827f nfnetlink: introduce generic netfilter subsystem decoder
* netlink_netfilter.c: Include "nlattr.h".
(decode_netlink_netfilter): Call decode_nlattr.
2018-03-11 15:35:19 +00:00
Chen Jingpiao
547b90e239 Move nl_netfilter_msg_types definition from netlink.c to netlink_netfilter.c
The side effect of #include "xlat/nl_netfilter_msg_types.h" is
NFNL_MSG_BATCH_* constants properly defined in that header file.
While netlink.c does not use these constants itself,
netlink_netfilter.c is going to need them soon.

* defs.h (nl_netfilter_msg_types): New xlat prototype.
* netlink.c: Move inclusion of "xlat/nl_netfilter_msg_types.h" ...
* netlink_netfilter.c: ... here.
2018-03-11 14:49:25 +00:00
Chen Jingpiao
91497f718e tests: add check for NETLINK_NETFILTER parser
* tests/netlink_netfilter.c: Include <netinet/in.h>, <arpa/inet.h>
and <linux/netfilter/nf_tables.h>.
Replace "netlink.h" with "test_netlink.h".
(NFNL_SUBSYS_NFTABLES, NFT_MSG_NEWTABLE): New macros.
(test_nlmsg_done, test_nfgenmsg): New functions.
(main): Use them.
2018-03-11 14:49:25 +00:00
Chen Jingpiao
106731a96c netlink: introduce NETLINK_NETFILTER parser
* netlink_netfilter.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (decode_netlink_netfilter): New prototype.
* netlink.c (netlink_decoders): Add NETLINK_NETFILTER.
* xlat/netfilter_versions.in: New file.
2018-03-11 14:49:25 +00:00
Chen Jingpiao
46471eeb42 xlat: remove NFNL_SUBSYS_COUNT constant
NFNL_SUBSYS_COUNT is not a symbol with some constant value, it changes
with time, just print it as an unrecognized number.

* xlat/nl_netfilter_subsys_ids.in (NFNL_SUBSYS_COUNT): Remove.
2018-03-11 14:49:25 +00:00
3524376809 inject_data: make room for more injection features
* defs.h (struct inject_data): Squeeze flags and signo fields from
uint16_t to uint8_t to make room for more injection features.
2018-03-10 00:13:04 +00:00
Eugene Syromyatnikov
8919eaa558 xlat: sort v4l2_pix_fmts.in and v4l2_sdr_fmts.in
* xlat/v4l2_pix_fmts.in: Sort by value, add a comment about sorting.
* xlat/v4l2_sdr_fmts.in: Likewise.
2018-03-09 02:48:30 +00:00
c7c7f94d83 xlat: add comments to all sorted xlat files
Add a short comment describing the method used to sort entries.

* xlat/ethernet_protocols.in: Update the comment about sorting.
* xlat/fsmagic.in: Likewise.
* xlat/evdev_keycode.in: Add a comment about sorting.
* xlat/hw_breakpoint_type.in: Likewise.
* xlat/perf_hw_cache_id.in: Likewise.
* xlat/perf_hw_cache_op_id.in: Likewise.
* xlat/perf_hw_cache_op_result_id.in: Likewise.
* xlat/perf_hw_id.in: Likewise.
* xlat/perf_sw_ids.in: Likewise.
* xlat/perf_type_id.in: Likewise.
2018-03-09 02:48:30 +00:00
Eugene Syromyatnikov
9ffdd1dfb6 bpf: remove page size caching
get_pagesize() has a static cache anyway, no need to duplicate it.

* bpf.c (SYS_FUNC(bpf)): Remove static size_t page_size and its
initialisation, use get_pagesize() as the size of buf directly.
2018-03-09 01:04:28 +00:00
Eugene Syromyatnikov
fcce81ed1a bpf_filter: fix indentation of the switch clause
* bpf_filter.c (print_bpf_filter_code): Fix switch clause indentation.
2018-03-09 01:04:28 +00:00
4d1da8537d xlat: provide fallback definitions for arch-independent mmap flags
This is important for recently introduced MAP_SHARED_VALIDATE flag.

* xlat/mmap_flags.in (MAP_SHARED, MAP_PRIVATE, MAP_SHARED_VALIDATE):
Add constant values.

Fixes: v4.21-67-g8c209d1 ("tests: fix remap_file_pages.test breakage on hppa")
2018-03-08 22:27:26 +00:00
Eugene Syromyatnikov
ffcd3a837f bpf: print kern_version in the form of KERNEL_VERSION macro
* bpf.c (DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Print
union bpf_attr.kern_version in the form of KERNEL_VERSION macro call.
* tests/bpf.c: Update expected output.
2018-03-07 22:07:20 +00:00
Eugene Syromyatnikov
8c209d1ad1 tests: fix remap_file_pages.test breakage on hppa
Apparently, hppa is the only architecture that has MAP_TYPE
defined to 0x3 instead of 0xf, and the tests hit that corner case.

* tests/remap_file_pages.c (main) [MAP_HUGETLB]: Print the value
of mapping type depending on the architecture (MAP_SHARED_VALIDATE
for hppa and unknown value for other architectures).

Fixes: v4.21~59 ("xlat: update MAP_* constants")
2018-03-07 22:07:20 +00:00
Eugene Syromyatnikov
9495ddada4 Sort Ethernet protocols xlat
* defs.h (ethernet_protocols_size): New declaration.
* netlink_packet_diag.c (decode_packet_diag_req): Use
printxval_searchnn to print Ethernet protocols.
* sockaddr.c (ethernet_protocols_size): New constant, item count
in ethernet_protocols array.
(print_sockaddr_data_ll): Use printxval_search instead of
printxval to print Ethernet protocols.
* xlat/ethernet_protocols.in: Sort it by value, add comment
about the fact.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-07 18:13:29 +00:00
Eugene Syromyatnikov
9611ebbb97 Change sorted arrays to be terminated with XLAT_END like unsorted arrays
It is quite unwieldy to have this distinction between sorted and
unsorted arrays when we can just decrement the size in a wrapper.

* defs.h (printxval_search): Decrement array size.
* xlat/fsmagic.in (#unterminated): Remove.
* xlat/hw_breakpoint_type.in (#unterminated): Remove.
* xlat/perf_hw_cache_id.in (#unterminated): Remove.
* xlat/perf_hw_cache_op_id.in (#unterminated): Remove.
* xlat/perf_hw_cache_op_result_id.in (#unterminated): Remove.
* xlat/perf_hw_id.in (#unterminated): Remove.
* xlat/perf_sw_ids.in (#unterminated): Remove.
* xlat/perf_type_id.in (#unterminated): Remove.
* xlat/gen.sh (gen_header): Remove #unterminated support.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-07 18:13:29 +00:00
Eugene Syromyatnikov
07a6399dd6 strace.1.in: add a note about tracing of scripts without shebang
* strace.1.in (.SH NOTES): Note that tracing of scripts without shebang
won't work.

Reported-by: Mike Parker
Closes: https://github.com/strace/strace/issues/46
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
e4e34b31ab strace.1.in: mention that -c suppresses regular output
As the note that -C makes strace "also print regular output" can be
easily overlooked.

* strace.1.in (.SS Statistics) <.TP .B \-c>: Mention that -c supresses
regular output.
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
08e1a244eb errnoent.h: add ERECALLCONFLICT
* linux/errnoent.h ([530]): Add ERECALLCONFLICT error introduced by
Linux commit v4.7-rc1~40^2~6.
* linux/alpha/errnoent.h ([530]): Likewise.
* linux/hppa/errnoent.h ([530]): Likewise.
* linux/mips/errnoent.h ([530]): Likewise.
* linux/sparc/errnoent.h ([530]): Likewise.
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
f5feb87faa xlat: add BPF_F_ALLOW_MULTI constant
* xlat/bpf_attach_flags.in (BPF_F_ALLOW_MULTI): New constant, introduced
by Linux commit v4.15-rc1~84^2~558^2~7.
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
edc666f7ce xlat: add BPF_MAP_TYPE_CPUMAP constant
* xlat/bpf_map_types.in (BPF_MAP_TYPE_CPUMAP): New constant, introduced
by Linux commit v4.15-rc1~84^2~427^2~4.
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
94810c80f9 tests/test_printstrn.c: do not declare i again 2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
87cd971e49 tests/s390_sthyi.c: make utility functions inline
When built with --enable-gcc-Werror, s390_sthyi test build fails
with the following error:

	s390_sthyi.c:63:1: error: ‘print_u8’ defined but not used [-Werror=unused-function]
	 print_u8(const char *prefix, unsigned char *buf, unsigned int offs, bool zero)
	 ^~~~~~~~

Apparently, after some back and forth, all occurrences of printing u8
values landed under verbose printing, so this function is no longer
used in non-verbose mode.  Let's avoid this in the future by inlining
all the utility functions in this test.

* tests/s390_sthyi.c (print_0x8, print_u8, print_u16, print_x32,
print_weight, ebcdic2ascii, is_empty, print_ebcdic): Add inline
qualifier.
[!VERBOSE] (is_empty): Remove "# if VERBOSE" guard.
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
bad2d7437c btrfs: print struct btrfs_ioctl_logical_ino_args.flags field
The field has been introduced in Linux commit v4.15-rc1~135^2~17.

* btrfs.c: Implement decoding of
struct btrfs_ioctl_logical_ino_args.flags field.
* configure.ac: Check for struct btrfs_ioctl_logical_ino_args.flags
presence in linux/btrfs.h.
* tests/btrfs.c: Update expected output, add additional checks.
* xlat/btrfs_logical_ino_args_flags.in: New file.
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
1ed1866ebd btrfs.c: print __u64 fields with pointer semantics using printaddr64
* btrfs.c (btrfs_ioctl) <case BTRFS_IOC_INO_PATHS>: Print fspath field
with printaddr64.
(btrfs_ioctl) <case BTRFS_IOC_LOGICAL_INO>: Print inodes field with
printaddr64.
* tests/btrfs.c: Add checks for NULL in fspath and inodes fields.
* NEWS: Mention it.
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
84c03b20b4 util.c: introduce printaddr64
Sometimes, 64-bit value is expected to be interpreted as an address
(in BTRFS ioctl interface, for example).

* defs.h (printaddr64): New declaration.
* util.c (printaddr64): Rename from printaddr, change argument type
to uint64_t.
(printaddr): Turn into a thin wrapper around printaddr64.
(printnum_addr_int, printnum_addr_int64): Use printaddr64 instead of
printaddr.  printnum_addr_int64 is not used outside the cases where
kernel_long is less or equal than 64 bit currently, so this change
should be safe.
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
beafdd36e1 prctl: add decoding of PR_SVE_SET_VL and PR_SVE_GET_VL commands
These commands were introduced in Linux commit v4.15-rc1~110^2~9.

* xlat/pr_sve_vl_flags.in: New file.
* xlat/prctl_options.in: Likewise.
* prctl.c: Include "xstring.h" and "xlat/pr_sve_vl_flags.h".
[!PR_SVE_VL_LEN_MASK] (PR_SVE_VL_LEN_MASK): New macro constant.
(sprint_sve_val): New function.
(SYS_FUNC(prctl)): Add decoding for PR_SVE_GET_VL and PR_SVE_SET_VL
commands.
* NEWS: Mention it.
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
fd02ce4ff8 Implement PTRACE_SECCOMP_GET_METADATA ptrace request decoding
* defs.h (seccomp_filter_flags): New declaration.
* process.c (SYS_FUNC(ptrace)): Implement PTRACE_SECCOMP_GET_METADATA
request decoding.
* ptrace.h [!PTRACE_SECCOMP_GET_METADATA] (PTRACE_SECCOMP_GET_METADATA):
New macro constant.
* xlat/ptrace_cmds.in (PTRACE_SECCOMP_GET_METADATA): New constant.
* tests/ptrace.c (main): Add some checks for PTRACE_SECCOMP_GET_METADATA
request decoding.
* NEWS: Mention it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-06 23:52:08 +00:00
0b03de74bc build: prepare for -Wimplicit-fallthrough=5
* gcc_compat.h (ATTRIBUTE_FALLTHROUGH): New macro.
* block.c (block_ioctl): Use it instead of "fall through" comment.
* btrfs.c (btrfs_ioctl): Likewise.
* loop.c (loop_ioctl): Likewise.
* mtd.c (mtd_ioctl): Likewise.
* rtc.c (rtc_ioctl): Likewise.
* v4l2.c (v4l2_ioctl): Likewise.
* dm.c (dm_decode_values): Likewise.
* process.c (SYS_FUNC(ptrace)): Likewise.
* quota.c (decode_cmd_data): Likewise.
* ucopy.c (umovestr): Likewise.
* unwind.c (unwind_print_stacktrace, unwind_capture_stacktrace)):
Likewise.
* term.c (term_ioctl): Add ATTRIBUTE_FALLTHROUGH.
* ioctl.c (ioctl_decode) [ALPHA || POWERPC]: Likewise.
* m4/st_warn_cflags.m4 (gl_WARN_ADD): Add -Wimplicit-fallthrough=5.
* tests/ioctl_v4l2.c (init_v4l2_format): Reorganize the switch statement
without implicit fallthrough.
2018-03-06 23:52:08 +00:00
Eugene Syromyatnikov
2f0842fe61 xlat: add eBPF-based device controller constants
Add new BPF_PROG_TYPE_CGROUP_DEVICE eBPF program type and new
BPF_CGROUP_DEVICE eBPF program attach type, added in Linux commit
v4.15-rc1~84^2~120^2~2.

* xlat/bpf_attach_type.in (BPF_CGROUP_DEVICE): New constant.
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_CGROUP_DEVICE): Likewise.
* NEWS: Mention it.
2018-03-05 15:03:37 +00:00
Eugene Syromyatnikov
1490d518c6 xlat: provide fallback definitions for input event constants
Values added using the following pair of commands:

	$ cat xlat/evdev_keycode.in |
		while read r; do [ -n "$r" ] &&
			sed -rn 's/^#define[[:space:]]+('$r'[[:space:]]+[^[:space:]]+).*/\1/p' \
			~/dev/linux/include/uapi/linux/input-event-codes.h || echo;
		done > xlat/evdev_keycode.in.new
	$ sort -s -n -k1,1 \
		<(awk '{if (NF>1) {last = strtonum($2)}; printf("%d %s\n", last, $0)}' \
			xlat/evdev_keycode.in.new) \
		| sed 's/^[0-9]* //'  > xlat/evdev_keycode.in

It also verifies that the values are sorted and bsearch-ready.

* xlat/evdev_keycode.in: Add constant values.
2018-03-02 21:53:08 +00:00
Eugene Syromyatnikov
e0f59c42d5 xlat: update the list of input event constants
Remove some duplicating definitions and add the new ones.

* xlat/evdev_keycode.in (KEY_HANGUEL): Remove, an alternative name for
KEY_HANGEUL.
(KEY_DIRECTION): Remove, an alternative name for KEY_ROTATE_DISPLAY.
(KEY_BRIGHTNESS_ZERO): Remove, an alternative name for
KEY_BRIGHTNESS_AUTO.
(KEY_WIMAX): Remove, an alternative name for KEY_WWAN.
(BTN_A): Remove, an alternative name for BTN_SOUTH.
(BTN_B): Remove, an alternative name for BTN_EAST.
(BTN_X): Remove, an alternative name for BTN_NORTH.
(BTN_Y): Remove, an alternative name for BTN_WEST.
(BTN_STYLUS3): New constant, added in Linux commit v4.15-rc1~114^2^2~1.
(KEY_BRIGHTNESS_TOGGLE): Remove, an alternative name for
KEY_DISPLAYTOGGLE.
(KEY_ROTATE_LOCK_TOGGLE): New constant, added in Linux commit
v4.16-rc1~54^2~67.
(KEY_DATA): New constant, added in Linux commit v4.9-rc8~12^2.
(KEY_ONSCREEN_KEYBOARD): New constant, added in Linux commit
v4.12-rc1~126^2~2^12~5.
* NEWS: Mention it.
2018-03-02 21:53:08 +00:00
Eugene Syromyatnikov
825f2b0d85 xlat: provide fallback definitions for SCTP socket option constants
Values for SCTP_GET_PEER_ADDRS_NUM_OLD, SCTP_GET_PEER_ADDRS_OLD,
SCTP_GET_LOCAL_ADDRS_NUM_OLD, SCTP_GET_LOCAL_ADDRS_OLD are reconstructed
from Linux commit v2.6.33-rc1~388^2~167^2~7.

xlat/socksctpoptions.in: Add constant values.
2018-03-02 21:53:08 +00:00
Eugene Syromyatnikov
67ec8128bf xlat: update the list of SCTP socket option constants
* xlat/socksctpoptions.in (SCTP_DELAYED_ACK): Rename to...
(SCTP_DELAYED_SACK): ...this, per Linux commit v2.6.38-rc2~33^2.
(SCTP_SOCKOPT_PEELOFF_FLAGS): New constant, introduced in Linux commit
v4.13-rc1~157^2~39.
(SCTP_STREAM_SCHEDULER): New constant, introduced in Linux commit
v4.15-rc1~84^2~567^2~3.
(SCTP_STREAM_SCHEDULER_VALUE): New constant, introduced in Linux commit
v4.15-rc1~84^2~567^2~2.
(SCTP_INTERLEAVING_SUPPORTED): New constant, introduced in Linux commit
 v4.16-rc1~123^2~384^2~11.
* NEWS: Mention it.
2018-03-02 21:53:08 +00:00
Eugene Syromyatnikov
fcef4697b9 xlat: provide fallback definitions for Ethernet protocol constants
As those are not architecture-specific.

* xlat/ethernet_protocols.in: Add values to constants.
2018-03-02 21:53:08 +00:00
Eugene Syromyatnikov
183233aff1 xlat: update the list of Ethernet protocol constants
* xlat/ethernet_protocols.in (ETH_P_ERSPAN2): New constant, introduced
in Linux commit v4.16-rc1~123^2~355^2~2.
(ETH_P_IBOE): New constant, introduced in commit v4.11-rc1~73^2~74.
* NEWS: Mention it.
2018-03-02 21:53:08 +00:00
Eugene Syromyatnikov
cfa55479c2 v4l2: print known pixel/SDR formats
* xlat/v4l2_pix_fmts.in: New file.
* xlat/v4l2_sdr_fmts.in: Likewise.
* v4l2.c [!v4l2_fourcc_be] (v4l2_fourcc_be): New macro.
(print_pixelformat): Add xlat parameter, print constant name
as a comment if it has been found in xlat.
(print_v4l2_fmtdesc, print_v4l2_frmivalenum): Pass v4l2_pix_fmts
to print_pixelformat.
(print_v4l2_format_fmt) <case V4L2_BUF_TYPE_VIDEO_CAPTURE, case
V4L2_BUF_TYPE_VIDEO_OUTPUT, case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, case V4L2_BUF_TYPE_VBI_CAPTURE,
case V4L2_BUF_TYPE_VBI_OUTPUT>: Pass v4l2_pix_fmts to print_pixelformat.
(print_v4l2_format_fmt) <case V4L2_BUF_TYPE_SDR_OUTPUT, case
V4L2_BUF_TYPE_SDR_CAPTURE>: Pass v4l2_sdr_fmts to print_pixelformat.
* tests/v4l2.c: Test it, update expected output.
* NEWS: Mention it.
2018-03-02 16:02:20 +00:00
Eugene Syromyatnikov
b82706f412 v4l2: v4l2_fourcc is endianness-agnostic
v4l2_fourcc(a, b, c, d) is defined as (a | (b << 8) | (c << 16) | (d << 24)
regardless of endianness (no mnemonic on big-endian architectures),
so we don't need special handling for WORDS_BIGENDIAN both in decoder
and in the test.

* v4l2.c (print_pixelformat): Change initialisation to a simple
assignment of character array.
* tests/ioctl_v4l2.c [WORDS_BIGENDIAN]: Remove.
* NEWS: Mention this fix.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Fixes: v4.10~371 "Implement Video4Linux video-input ioctls decoder"
2018-03-02 16:02:20 +00:00
6675b67366 tests: do not include <stdbool.h> in files that include "tests.h"
Starting with commit v4.21-37-g4f63bc70ca95012d72e288fc3c1eeb3ba26068a4,
<stdbool.h> is included by tests.h, so all tests that already include
"tests.h" do not need to include <stdbool.h>.

* tests/btrfs.c: Do not include <stdbool.h>.
* tests/file_handle.c: Likewise.
* tests/futex.c: Likewise.
* tests/ioctl_dm.c: Likewise.
* tests/ioctl_loop.c: Likewise.
* tests/ioctl_sock_gifconf.c: Likewise.
* tests/keyctl.c: Likewise.
* tests/mq_sendrecv.c: Likewise.
* tests/perf_event_open.c: Likewise.
* tests/s390_guarded_storage.c: Likewise.
* tests/s390_pci_mmio_read_write.c: Likewise.
* tests/s390_sthyi.c: Likewise.
* tests/xet_thread_area_x86.c: Likewise.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
08b4355d9c tests: check printing of block/char device numbers in -yy mode
* tests/dev-yy.c: New file.
* tests/pure_executables.list: Add dev-yy.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (dev-yy): New test.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
48feeb3723 printfd: print character/block device number in -yy mode
* util.c: Include <sys/stat.h>, <sys/sysmacros.h>,
and "largefile_wrappers.h".
(printsocket, printdev): New functions.
(printfd): Move socket matching/printing logic to printsocket.  Check
also for printdev.  Escape opening angle bracket in addition to closing angle
bracket as it can show up as a separator in printdev.
* tests/fsync-y.c: Update expected output.
* strace.1.in: Mention this.
* NEWS: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
6d36a70868 util.c: escape closing angle bracket in printfd
* util.c (printfd): Use print_quoted_string_ex instead of
print_quoted_string, specify ">" as escape_chars argument.
* tests/fsync-y.c (main): Update expected output.
* NEWS: Mention it.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
0b732f7e9d util.c: add support for additional escape characters in string_quote
Quotes are not always used to denote string limits; printfd uses angle
brackets for that, for example.  As result, mechanism for supplying
set of additional characters in order to avoid ambiguities regarding
the end of the quoted string is needed.

* defs.h (string_quote): Add escape_chars parameter.
(print_quoted_string_ex): New function prototype.
* util.c (string_quote): Add escape_chars parameter.
(print_quoted_string_ex): Rename from print_quoted_string, add
escape_chars parameter, pass it to string_quote call.
(print_quoted_string): Turn into a thin wrapper around
print_quoted_string_ex.
(printstr_ex): Pass NULL as escape_chars argument of string_quote call.
* socketutils.c (unix_parse_response): Pass NULL as escape_chars
argument of string_quote call.
* tests/print_quoted_string.c (print_octal): New function.
print_quoted_memory_ex): Use it.  Add escape_chars parameter.
(print_quoted_memory): Pass NULL as escape_chars argument
of print_quoted_memory_ex call.
* tests/tests.h (print_quoted_string_ex, print_quoted_memory_ex): Add
escape_chars parameter.
* tests/fsync-y.c: Pass NULL as escape_chars argument of
print_quoted_string_ex call.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
e196eebea4 tests: check file name printing in strace -y mode
* tests/fsync-y.c: New file.
* tests/.gitignore: Add fsync-y.
* tests/Makefile.am (check_PROGRAMS): Likewise.
* tests/gen_tests.in (fsync-y): New test.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
eda9b3d227 tests: add print_quoted_string_ex and print_quoted_memory_ex functions
* tests/tests.h (print_quoted_string_ex, print_quoted_memory_ex): New
declarations.
* tests/print_quoted_string.c (print_quoted_string_ex): New function,
a thin wrapper around print_quoted_memory_ex wrapper.
(print_quoted_memory_ex): Rename from print_quoted_memory, add quote
argument.
(print_quoted_memory): Turn into a thin wrapper around
print_quoted_memory_ex.
2018-03-01 01:00:24 +00:00
Eugene Syromyatnikov
69430cd977 tests: check escaping in string printing
* tests/test_printstrn.c (test_print_memory): New function.
(test_printstrn): Use it.
2018-03-01 01:00:24 +00:00