7 Commits
16 changed files with 158 additions and 13 deletions
+1
View File
@@ -101,6 +101,7 @@ tests/Transfer_-_--rate-limit.test \
tests/Transfer_-_--remote.test \
tests/Transfer_-_--stop-at-size.test \
tests/Transfer_-_--stop-at-size_reads.test \
tests/Watchfd_-_Multiple_arguments.test \
tests/Watchfd_-_Multiple_descriptors.test \
tests/Watchfd_-_Single_descriptor.test
+1 -1
View File
@@ -4,7 +4,7 @@ dnl Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2025 Andrew Wood
dnl
dnl License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
AC_INIT([pv], [1.10.0], [https://codeberg.org/ivarch/pv/issues], [pv], [https://ivarch.com/p/pv])
AC_INIT([pv], [1.10.1], [https://codeberg.org/ivarch/pv/issues], [pv], [https://ivarch.com/p/pv])
AC_CONFIG_SRCDIR([src/include/config.h.in])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([src/include/config.h])
+4
View File
@@ -1,3 +1,7 @@
### 1.10.1 - 12 November 2025
* *fix:* correct **--watchfd** memory allocation error when given multiple arguments ([#170](https://codeberg.org/ivarch/pv/issues/170))
### 1.10.0 - 7 November 2025
* *feature:* new **--query** option to show the transfer status of another running **pv** ([#101](https://codeberg.org/ivarch/pv/issues/101))
+1 -1
View File
@@ -1,4 +1,4 @@
.TH PV 1 2025-11-07 pv-1.10.0 "User Commands"
.TH PV 1 2025-11-12 pv-1.10.1 "User Commands"
.\"
.SH NAME
pv \- monitor and manage the progress of data through a pipe
+1 -1
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-10-31 19:47+0000\n"
"POT-Creation-Date: 2025-11-12 11:28+0000\n"
"PO-Revision-Date: 2024-10-13 20:43+0000\n"
"Last-Translator: mmatous <mmatous@users.noreply.translate.codeberg.org>\n"
"Language-Team: Czech <https://translate.codeberg.org/projects/pv/pv/cs/>\n"
+1 -1
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-10-31 19:47+0000\n"
"POT-Creation-Date: 2025-11-12 11:28+0000\n"
"PO-Revision-Date: 2025-01-14 20:39+0000\n"
"Last-Translator: Benny <benny@users.noreply.translate.codeberg.org>\n"
"Language-Team: German <https://translate.codeberg.org/projects/pv/pv/de/>\n"
+1 -1
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-10-31 19:47+0000\n"
"POT-Creation-Date: 2025-11-12 11:28+0000\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
+1 -1
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pv 1.9.34\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-10-31 19:47+0000\n"
"POT-Creation-Date: 2025-11-12 11:28+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
+1 -1
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-10-31 19:47+0000\n"
"POT-Creation-Date: 2025-11-12 11:28+0000\n"
"PO-Revision-Date: 2025-05-31 08:58+0000\n"
"Last-Translator: milimarg <milimarg@noreply.codeberg.org>\n"
"Language-Team: French <https://translate.codeberg.org/projects/pv/pv/fr/>\n"
+1 -1
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-10-31 19:47+0000\n"
"POT-Creation-Date: 2025-11-12 11:28+0000\n"
"PO-Revision-Date: 2025-10-02 13:23+0000\n"
"Last-Translator: Coral Pink <coralpink@noreply.codeberg.org>\n"
"Language-Team: Polish <https://translate.codeberg.org/projects/pv/pv/pl/>\n"
+1 -1
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-10-31 19:47+0000\n"
"POT-Creation-Date: 2025-11-12 11:28+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
+1 -1
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-10-31 19:47+0000\n"
"POT-Creation-Date: 2025-11-12 11:28+0000\n"
"PO-Revision-Date: 2025-01-15 19:08+0000\n"
"Last-Translator: 0ko <0ko@users.noreply.translate.codeberg.org>\n"
"Language-Team: Russian <https://translate.codeberg.org/projects/pv/pv/ru/>\n"
+1 -1
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pv 1.8.14\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2025-10-31 19:47+0000\n"
"POT-Creation-Date: 2025-11-12 11:28+0000\n"
"PO-Revision-Date: 2025-10-05 20:09+0000\n"
"Last-Translator: Oğuz Ersen <ersen@noreply.codeberg.org>\n"
"Language-Team: Turkish <https://translate.codeberg.org/projects/pv/pv/tr/>\n"
+2 -2
View File
@@ -836,14 +836,14 @@ void pv_state_watchfds(pvstate_t state, unsigned int watchfd_count, const pid_t
state->watchfd.multiple_pids = false;
/* Allocate an empty new array of the right size. */
new_array = malloc((1 + state->watchfd.count) * sizeof(*new_array));
new_array = malloc((1 + watchfd_count) * sizeof(*new_array));
if (NULL == new_array) {
/*@-mustfreefresh@ *//* see similar _() issue above */
pv_error("%s: %s", _("buffer allocation failed"), strerror(errno));
/*@+mustfreefresh@ */
return;
}
memset(new_array, 0, (1 + state->watchfd.count) * sizeof(*new_array));
memset(new_array, 0, (1 + watchfd_count) * sizeof(*new_array));
state->watchfd.watching = new_array;
/* Populate the new array with the values supplied. */
+39
View File
@@ -65,4 +65,43 @@ pid=$!
sleep 0.1
{ runWithValgrind -P "${workFile3}" -d "${pid}" -f -i 0.5 >/dev/null 2>&1; } 4>&1 || exit 1
# Check "--watchfd PID1 PID2".
seq 1 100 > "${workFile1}"
seq 1 300 > "${workFile2}"
true > "${workFile3}"
# shellcheck disable=SC2030
(
while test -e "${workFile3}" && ! test -s "${workFile3}"; do sleep 0.1; done
sleep 1
read -r line
exec 9<"${workFile2}"
sleep 1
exec 8<"${workFile1}"
exec 7</dev/null
sleep 1
exec 9<&-
# shellcheck disable=SC2034
read -r line
sleep 1
) <"${workFile1}" &
pid1=$!
# shellcheck disable=SC2030
(
while test -e "${workFile3}" && ! test -s "${workFile3}"; do sleep 0.1; done
sleep 1
read -r line
exec 9<"${workFile2}"
sleep 1
exec 8<"${workFile1}"
exec 7</dev/null
sleep 1
exec 9<&-
# shellcheck disable=SC2034
read -r line
sleep 1
) <"${workFile1}" &
pid2=$!
sleep 0.1
{ runWithValgrind -P "${workFile3}" -f -i 0.5 -d "${pid1}" "${pid2}" >/dev/null 2>&1; } 4>&1 || exit 1
exit 0
+101
View File
@@ -0,0 +1,101 @@
#!/bin/sh
#
# Check that watching a process's file descriptors works as expected when
# given multiple arguments.
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
true "${workFile3:?not set - call this from 'make check'}"
true "${workFile4:?not set - call this from 'make check'}"
# Skip the test if "-d" is not available.
if ! "${testSubject}" -h | grep -Fq ' -d'; then
echo "no \`--watchfd' / \`-d' option on this platform"
exit 77
fi
seq 1 100 > "${workFile1}"
seq 1 300 > "${workFile2}"
# Run two background processes to perform a few reads from a file.
#
# Each one only starts doing anything once the PV process below has started
# (the workFile3 check).
true > "${workFile3}"
(
while test -e "${workFile3}" && ! test -s "${workFile3}"; do sleep 0.1; done
sleep 1
# shellcheck disable=SC2034 # line is deliberately unused
read -r line <&8
sleep 1
) <&- 8<"${workFile1}" &
pid1=$!
(
while test -e "${workFile3}" && ! test -s "${workFile3}"; do sleep 0.1; done
sleep 1
# shellcheck disable=SC2034 # line is deliberately unused
read -r line <&9
sleep 1
) <&- 9<"${workFile2}" &
pid2=$!
sleep 0.1
"${testSubject}" -P "${workFile3}" -f -i 0.5 -d "${pid1}" "${pid2}" >/dev/null 2>"${workFile4}"
# Skip the test if "-d" does not work.
if grep -Fq ' -d: not available' "${workFile4}"; then
echo "no \`--watchfd' / \`-d' option on this platform"
exit 77
fi
# Process the output to make it easier to handle.
# NB "ESC [ A" is "cursor up", we turn that into "-" and a newline.
tr '\r' '\n' < "${workFile4}" | sed 's/.\[A/-!/g' | tr '!' '\n' > "${workFile1}"
# We should see at least 2 file positions for fd 8.
positionsReported="$(awk '/^[0-9 ]+: *8:/ {print $3}' < "${workFile1}" | sort -n | uniq)"
differentNumbers="$(printf "%s\n" "${positionsReported}" | grep -Ec .)"
if ! test "${differentNumbers}" -gt 1; then
printf "%s\n" "Expected at least 2 different numbers to be output for fd 8"
printf "%s:\n%s\n" "Positions reported" "${positionsReported}"
printf "%s: %s\n" "Number of different values seen" "${differentNumbers}"
printf "%s\n" "Raw output:"
cat "${workFile1}"
exit 1
fi
# We should see at least 2 file positions for fd 9.
positionsReported="$(awk '/^[0-9 ]+: *9:/ {print $3}' < "${workFile1}" | sort -n | uniq)"
differentNumbers="$(printf "%s\n" "${positionsReported}" | grep -Ec .)"
if ! test "${differentNumbers}" -gt 1; then
printf "%s\n" "Expected at least 2 different numbers to be output for fd 9"
printf "%s:\n%s\n" "Positions reported" "${positionsReported}"
printf "%s: %s\n" "Number of different values seen" "${differentNumbers}"
printf "%s\n" "Raw output:"
cat "${workFile1}"
exit 1
fi
# We should see the last 6 characters of fd 8's filename appear.
lastChars="$(printf "%s\n" "${workFile1}" | rev | cut -b1-6 | rev)"
if ! grep -Fq "${lastChars}:" < "${workFile1}"; then
printf "%s\n" "Expected to see a filename for fd 8"
printf "%s\n" "Raw output:"
cat "${workFile1}"
exit 1
fi
# We should see the last 6 characters of fd 9's filename appear.
lastChars="$(printf "%s\n" "${workFile2}" | rev | cut -b1-6 | rev)"
if ! grep -Fq "${lastChars}:" < "${workFile1}"; then
printf "%s\n" "Expected to see a filename for fd 9"
printf "%s\n" "Raw output:"
cat "${workFile1}"
exit 1
fi
exit 0