From 01837669afa740b594d2075661dc9faa3ab6fe43 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 7 Apr 2014 16:40:12 +0200 Subject: make apt search case-insensitive by default --- test/integration/test-apt-cli-search | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/test-apt-cli-search b/test/integration/test-apt-cli-search index 84650b366..58613717b 100755 --- a/test/integration/test-apt-cli-search +++ b/test/integration/test-apt-cli-search @@ -13,7 +13,7 @@ if [ ! -x ${BUILDDIRECTORY}/apt ]; then exit 0 fi -DESCR='Some description that has a unusual word xxyyzz and aabbcc' +DESCR='Some description that has a unusual word xxyyzz and aabbcc and a UPPERCASE' DESCR2='Some other description with the unusual aabbcc only' insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR" insertpackage 'testing' 'bar' 'i386' '2.0' '' '' "$DESCR2" @@ -39,6 +39,11 @@ testequal "foo/unstable 1.0 all $DESCR " apt search -qq aabbcc xxyyzz +# search is not case-sensitive by default +testequal "foo/unstable 1.0 all + $DESCR +" apt search -qq uppercase + # output is sorted and search word finds both package testequal "bar/testing 2.0 i386 $DESCR2 -- cgit v1.2.3 From 5572f6bdcb947e11f32e2a035438d9d3899ad46d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 9 Apr 2014 15:28:00 +0200 Subject: Fix possible race when stunnel/aptwebserver create their PID files This patch should fix spurious test failures in jenkins or travis that are caused by a race condition in the {stunnel,aptwebserver}.pid file creation --- test/integration/framework | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 1c6f041b0..8d8a0becc 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -879,6 +879,20 @@ rewritesourceslist() { done } +# wait for up to 10s for a pid file to appear to avoid possible race +# when a helper is started and dosn't write the PID quick enough +waitforpidfile() { + local PIDFILE="$1" + for i in $(seq 10); do + if test -s "$PIDFILE"; then + return 0 + fi + sleep 1 + done + msgdie "waiting for $PIDFILE failed" + return 1 +} + changetowebserver() { if [ "$1" != '--no-rewrite' ]; then rewritesourceslist 'http://localhost:8080/' @@ -892,6 +906,7 @@ changetowebserver() { cat $LOG false fi + waitforpidfile aptwebserver.pid local PID="$(cat aptwebserver.pid)" if [ -z "$PID" ]; then msgdie 'Could not fork aptwebserver successfully' @@ -919,7 +934,11 @@ accept = 4433 connect = 8080 " > ${TMPWORKINGDIRECTORY}/stunnel.conf stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" + waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" local PID="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)" + if [ -z "$PID" ]; then + msgdie 'Could not fork stunnel4 successfully' + fi addtrap 'prefix' "kill ${PID};" rewritesourceslist 'https://localhost:4433/' } -- cgit v1.2.3 From f22b65b47990237bd5d9a1c171919c3059fbd9b0 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 9 Apr 2014 10:12:10 +0200 Subject: Fix insecure file permissions when using FileFd with OpenMode::Atomic Commit 7335eebea6dd43581d4650a8818b06383ab89901 introduced a bug that caused FileFd to create insecure permissions when FileFd::Atomic is used. This commit fixes the permissions and adds a test. The bug is most likely caused by the confusing "Perm" parameter that is passed to Open() - its not the file permissions but intead the "mode" part of open/creat. --- test/libapt/fileutl_test.cc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test') diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index 8da832ba9..1d1a1a1b8 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -6,13 +6,44 @@ #include #include #include +#include #include "assert.h" +// regression test for permission bug LP: #1304657 +static bool +TestFileFdOpenPermissions(mode_t a_umask, mode_t ExpectedFilePermission) +{ + FileFd f; + struct stat buf; + static const char* fname = "test.txt"; + + umask(a_umask); + f.Open(fname, FileFd::ReadWrite|FileFd::Atomic); + f.Close(); + if (stat(fname, &buf) < 0) + { + _error->Errno("stat", "failed to stat"); + _error->DumpErrors(); + return false; + } + unlink(fname); + equals(buf.st_mode & 0777, ExpectedFilePermission); + return true; +} + int main() { std::vector files; + if (TestFileFdOpenPermissions(0002, 0664) == false || + TestFileFdOpenPermissions(0022, 0644) == false || + TestFileFdOpenPermissions(0077, 0600) == false || + TestFileFdOpenPermissions(0026, 0640) == false) + { + return 1; + } + // normal match files = Glob("*.lst"); if (files.size() != 1) -- cgit v1.2.3