notmuch/lib
Jani Nikula a352d9ceaa lib: fix handling of one character long directory names at top level
The code to skip multiple slashes in _notmuch_database_split_path()
skips back one character too much. This is compensated by a +1 in the
length parameter to the strndup() call. Mostly this works fine, but if
the path is to a file under a top level directory with one character
long name, the directory part is mistaken to be part of the file name
(slash == path in code). The returned directory name will be the empty
string and the basename will be the full path, breaking the indexing
logic in notmuch new.

Fix the multiple slash skipping to keep the slash variable pointing at
the last slash, and adjust strndup() accordingly.

The bug was introduced in

commit e890b0cf40
Author: Carl Worth <cworth@cworth.org>
Date:   Sat Dec 19 13:20:26 2009 -0800

    database: Store the parent ID for each directory document.

just a little over two months after the initial commit in the Notmuch
code history, making this the longest living bug in Notmuch to date.
2016-04-12 20:40:19 -03:00
..
database-private.h lib: Add "lastmod:" queries for filtering by last modification 2015-08-14 18:23:49 +02:00
database.cc lib: fix handling of one character long directory names at top level 2016-04-12 20:40:19 -03:00
directory.cc lib: add interface to delete directory documents 2015-10-10 09:14:25 -03:00
filenames.c lib: fix NULL checks for filenames iterators 2012-09-01 23:03:11 -03:00
gen-version-script.sh build: add "set -eu" to version script generation 2015-07-28 21:34:01 +02:00
index.cc lib: content disposition values are not case-sensitive 2015-11-19 07:47:29 -04:00
libsha1.c util: detect byte order 2013-11-27 07:43:29 -04:00
libsha1.h fix sum moar typos [comments in source code] 2011-06-23 15:58:39 -07:00
Makefile fix sum moar typos [build scripts, Makefiles] 2011-06-23 15:44:59 -07:00
Makefile.local build: extract library versions from notmuch.h 2015-08-10 13:53:55 +02:00
message-file.c util: move strcase_equal and strcase_hash to util 2015-09-07 09:43:31 -03:00
message.cc clean up stray apostrophe in comment 2016-01-16 08:17:15 -04:00
messages.c lib: Eliminate _notmuch_message_list_append 2013-02-18 20:20:38 -04:00
notmuch-private.h util: move strcase_equal and strcase_hash to util 2015-09-07 09:43:31 -03:00
notmuch.h lib: NOTMUCH_DEPRECATED macro also for older compilers 2016-03-14 19:54:32 -03:00
parse-time-vrp.cc lib: add support for date:<expr>..! to mean date:<expr>..<expr> 2015-09-25 21:55:24 -03:00
parse-time-vrp.h lib: add date range query support 2012-10-31 16:55:32 -03:00
query.cc lib: add versions of n_q_count_{message,threads} with status return 2015-10-05 19:44:07 -03:00
sha1.c lib: Start all function names in notmuch-private.h with 2014-07-13 12:25:29 -03:00
string-list.c Fixup string list author 2011-03-21 02:45:18 -04:00
tags.c lib: fix warnings when building with clang 2012-12-01 08:10:32 -04:00
thread.cc lib: migrate thread.cc to new query_search API 2015-10-05 19:53:53 -03:00