summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* daemon: fix length computation in newline strippingjk/daemon-fixesJeff King2018-01-252-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When git-daemon gets a pktline request, we strip off any trailing newline, replacing it with a NUL. Clients prior to 5ad312bede (in git v1.4.0) would send: git-upload-pack repo.git\n and we need to strip it off to understand their request. After 5ad312bede, we send the host attribute but no newline, like: git-upload-pack repo.git\0host=example.com\0 Both of these are parsed correctly by git-daemon. But if some client were to combine the two: git-upload-pack repo.git\n\0host=example.com\0 we don't parse it correctly. The problem is that we use the "len" variable to record the position of the NUL separator, but then decrement it when we strip the newline. So we start with: git-upload-pack repo.git\n\0host=example.com\0 ^-- len and end up with: git-upload-pack repo.git\0\0host=example.com\0 ^-- len This is arguably correct, since "len" tells us the length of the initial string, but we don't actually use it for that. What we do use it for is finding the offset of the extended attributes; they used to be at len+1, but are now at len+2. We can solve that by just leaving "len" where it is. We don't have to care about the length of the shortened string, since we just treat it like a C string. No version of Git ever produced such a string, but it seems like the daemon code meant to handle this case (and it seems like a reasonable thing for somebody to do in a 3rd-party implementation). Reported-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t/lib-git-daemon: add network-protocol helpersJeff King2018-01-252-1/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All of our git-protocol tests rely on invoking the client and having it make a request of a server. That gives a nice real-world test of how the two behave together, but it doesn't leave any room for testing how a server might react to _other_ clients. Let's add a few test helper functions which can be used to manually conduct a git-protocol conversation with a remote git-daemon: 1. To connect to a remote git-daemon, we need something like "netcat". But not everybody will have netcat. And even if they do, the behavior with respect to half-duplex shutdowns is not portable (openbsd netcat has "-N", with others you must rely on "-q 1", which is racy). Here we provide a "fake_nc" that is capable of doing a client-side netcat, with sane half-duplex semantics. It relies on perl's IO::Socket::INET. That's been in the base distribution since 5.6.0, so it's probably available everywhere. But just to be on the safe side, we'll add a prereq. 2. To help tests speak and read pktline, this patch adds packetize() and depacketize() functions. I've put fake_nc() into lib-git-daemon.sh, since that's really the only server where we'd need to use a network socket. Whereas the pktline helpers may be of more general use, so I've added them to test-lib-functions.sh. Programs like upload-pack speak pktline, but can talk directly over stdio without a network socket. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* daemon: handle NULs in extended attribute stringJeff King2018-01-252-8/+9
| | | | | | | | | | | | | | | | | | | | | | | If we receive a request with extended attributes after the NUL, we try to write those attributes to the log. We do so with a "%s" format specifier, which will only show characters up to the first NUL. That's enough for printing a "host=" specifier. But since dfe422d04d (daemon: recognize hidden request arguments, 2017-10-16) we may have another NUL, followed by protocol parameters, and those are not logged at all. Let's cut out the attempt to show the whole string, and instead log when we parse individual attributes. We could leave the "extended attributes (%d bytes) exist" part of the log, which in theory could alert us to attributes that fail to parse. But anything we don't parse as a "host=" parameter gets blindly added to the "protocol" attribute, so we'd see it in that part of the log. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* daemon: fix off-by-one in logging extended attributesJeff King2018-01-252-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If receive a request like: git-upload-pack /foo.git\0host=localhost we mark the offset of the NUL byte as "len", and then log the bytes after the NUL with a "%.*s" placeholder, using "pktlen - len" as the length, and "line + len + 1" as the start of the string. This is off-by-one, since the start of the string skips past the separating NUL byte, but the adjusted length includes it. Fortunately this doesn't actually read past the end of the buffer, since "%.*s" will stop when it hits a NUL. And regardless of what is in the buffer, packet_read() will always add an extra NUL terminator for safety. As an aside, the git.git client sends an extra NUL after a "host" field, too, so we'd generally hit that one first, not the one added by packet_read(). You can see this in the test output which reports 15 bytes, even though the string has only 14 bytes of visible data. But the point is that even a client sending unusual data could not get us to read past the end of the buffer, so this is purely a cosmetic fix. Reported-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t/lib-git-daemon: record daemon logJeff King2018-01-251-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we start git-daemon for our tests, we send its stderr log stream to a named pipe. We synchronously read the first line to make sure that the daemon started, and then dump the rest to descriptor 4. This is handy for debugging test output with "--verbose", but the tests themselves can't access the log data. Let's dump the log into a file, as well, so that future tests can check the log. There are a few subtleties worth calling out here: - we'll continue to send output to descriptor 4 for viewing/debugging, which would imply swapping out "cat" for "tee". But we want to ensure that there's no buffering, and "tee" doesn't have a standard way to ask for that. So we'll use a shell loop around "read" and "printf" instead. That ensures that after a request has been served, the matching log entries will have made it to the file. - the existing first-line shell loop used read/echo. We'll switch to consistently using "read -r" and "printf" to relay data as faithfully as possible. - we open the logfile for append, rather than just output. That makes it OK for tests to truncate the logfile without restarting the daemon (the OS will atomically seek to the end of the file when outputting each line). That allows tests to look at the log without worrying about pollution from earlier tests. Helped-by: Lucas Werkmeister <mail@lucaswerkmeister.de> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t5570: use ls-remote instead of clone for interp testsJeff King2018-01-251-6/+3
| | | | | | | | | | | We don't actually care about the clone operation here; we just want to know if we were able to actually contact the remote repository. Using ls-remote does that more efficiently, and without us having to worry about managing the tmp.git directory. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Git 2.16.1v2.16.1Junio C Hamano2018-01-213-2/+13
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'bc/hash-algo' into maintJunio C Hamano2018-01-212-1/+18
|\ | | | | | | | | | | * bc/hash-algo: t5601-clone: test case-conflicting files on case-insensitive filesystem repository: pre-initialize hash algo pointer
| * t5601-clone: test case-conflicting files on case-insensitive filesystemEric Sunshine2018-01-211-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A recently introduced regression caused a segfault at clone time on case-insensitive filesystems when filenames differing only in case are present. This bug has already been fixed (repository: pre-initialize hash algo pointer, 2018-01-18), but it's not the first time similar problems have arisen. Therefore, introduce a test to catch this case and protect against future regressions. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * repository: pre-initialize hash algo pointerbrian m. carlson2018-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are various git subcommands (among them, clone) which don't set up the repository (that is, they lack RUN_SETUP or RUN_SETUP_GENTLY) but end up needing to have information about the hash algorithm in use. Because the hash algorithm is part of struct repository and it's only initialized in repository setup, we can end up dereferencing a NULL pointer in some cases if we call one of these subcommands and look up the empty blob or empty tree values. A "git clone" of a project that has two paths that differ only in case suffers from this if it is run on a case insensitive platform. When the command attempts to check out one of these two paths after checking out the other one, the checkout codepath needs to see if the version that is already on the filesystem (which should not happen if the FS were case sensitive) is dirty, and it needs to exercise the hashing code at that point. In the future, we can add a command line option for this or read it from the configuration, but until we're ready to expose that functionality to the user, simply initialize the repository structure to use the current hash algorithm, SHA-1. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Git 2.16v2.16.0Junio C Hamano2018-01-172-3/+6
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge tag 'l10n-2.16.0-rnd2' of git://github.com/git-l10n/git-poJunio C Hamano2018-01-1612-20028/+22202
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | l10n for Git 2.16.0 round 2 * tag 'l10n-2.16.0-rnd2' of git://github.com/git-l10n/git-po: (24 commits) l10n: de.po: translate 72 new messages l10n: de.po: improve messages when a branch starts to track another ref l10n: bg.po: Updated Bulgarian translation (3288t) l10n: TEAMS: add zh_CN team members l10n: zh_CN: for git v2.16.0 l10n round 2 l10n: sv.po: Update Swedish translation (3288t0f0u) l10n: ru.po: update Russian translation l10n: TEAMS: Add ko team members l10n: ko.po: Update Korean translation l10n: fr.po 2.16 round 2 l10n: es.po: Spanish translation 2.16.0 round 2 l10n: vi.po(3288t): Updated Vietnamese translation for v2.16.0 round 2 l10n: git.pot: v2.16.0 round 2 (8 new, 4 removed) l10n: es.po: Update Spanish Translation v2.16.0 l10n: fr.po v2.16.0 round 1 l10n: bg.po: Updated Bulgarian translation (3284t) l10n: sv.po: Update Swedish translation (3284t0f0u) l10n: fr.po: "worktree list" mistranslated as prune l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed) l10n: fixes to German translation ...
| * | l10n: de.po: translate 72 new messagesRalf Thielow2018-01-151-1934/+2172
| | | | | | | | | | | | | | | | | | | | | | | | | | | Translate 72 new messages came from git.pot update in 18a907225 (l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed)) and 005c62fe4 (l10n: git.pot: v2.16.0 round 2 (8 new, 4 removed)). Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Acked-by: Matthias Rüster <matthias.ruester@gmail.com>
| * | l10n: de.po: improve messages when a branch starts to track another refRalf Thielow2018-01-151-8/+8
| | | | | | | | | | | | Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
| * | l10n: bg.po: Updated Bulgarian translation (3288t)Alexander Shopov2018-01-111-181/+203
| | | | | | | | | | | | Signed-off-by: Alexander Shopov <ash@kambanaria.org>
| * | l10n: TEAMS: add zh_CN team membersJiang Xin2018-01-101-0/+1
| | | | | | | | | | | | | | | | | | Add Fangyi Zhou to zh_CN l10n team members. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| * | l10n: zh_CN: for git v2.16.0 l10n round 2Jiang Xin2018-01-101-1920/+2144
| | | | | | | | | | | | | | | | | | | | | | | | Translate 72 messages (3288t0f0u) for git v2.16.0-rc1. Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Reviewed-by: 依云 <lilydjwg@gmail.com> Reviewed-by: Fangyi Zhou <fangyi.zhou@yuriko.moe>
| * | Merge branch 'master' of git://github.com/nafmo/git-l10n-svJiang Xin2018-01-101-181/+197
| |\ \ | | | | | | | | | | | | | | | | * 'master' of git://github.com/nafmo/git-l10n-sv: l10n: sv.po: Update Swedish translation (3288t0f0u)
| | * | l10n: sv.po: Update Swedish translation (3288t0f0u)Peter Krefting2018-01-091-181/+197
| | | | | | | | | | | | | | | | Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
| * | | Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ruJiang Xin2018-01-101-1918/+2092
| |\ \ \ | | | | | | | | | | | | | | | | | | | | * 'russian-l10n' of https://github.com/DJm00n/git-po-ru: l10n: ru.po: update Russian translation
| | * | | l10n: ru.po: update Russian translationDimitriy Ryazantcev2018-01-091-1918/+2092
| | |/ / | | | | | | | | | | | | Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
| * | | l10n: TEAMS: Add ko team membersChangwoo Ryu2018-01-091-0/+2
| |/ / | | | | | | | | | | | | | | | Add Gwan-gyeong Mun and Sihyeon Jang. Signed-off-by: Changwoo Ryu <cwryu@debian.org>
| * | Merge branch 'ko/merge-l10n' of https://github.com/git-l10n-ko/git-l10n-koJiang Xin2018-01-092-1944/+2200
| |\ \ | | | | | | | | | | | | | | | | * 'ko/merge-l10n' of https://github.com/git-l10n-ko/git-l10n-ko: l10n: ko.po: Update Korean translation
| | * | l10n: ko.po: Update Korean translationChangwoo Ryu2018-01-082-1944/+2200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Changwoo Ryu <cwryu@debian.org> Signed-off-by: Sihyeon Jang <uneedsihyeon@gmail.com> Signed-off-by: Gwan-gyeong Mun <elongbug@gmail.com> Reviewed-by: Changwoo Ryu <cwryu@debian.org>
| * | | Merge branch '2.16' of https://github.com/ChrisADR/git-poJiang Xin2018-01-081-181/+197
| |\ \ \ | | | | | | | | | | | | | | | | | | | | * '2.16' of https://github.com/ChrisADR/git-po: l10n: es.po: Spanish translation 2.16.0 round 2
| | * | | l10n: es.po: Spanish translation 2.16.0 round 2Christopher Díaz Riveros2018-01-071-181/+197
| | |/ / | | | | | | | | | | | | Signed-off-by: Christopher Díaz Riveros <chrisadr@gentoo.org>
| * | | Merge branch 'fr_2.16-rc1' of git://github.com/jnavila/gitJiang Xin2018-01-081-192/+225
| |\ \ \ | | | | | | | | | | | | | | | | | | | | * 'fr_2.16-rc1' of git://github.com/jnavila/git: l10n: fr.po 2.16 round 2
| | * | | l10n: fr.po 2.16 round 2Jean-Noel Avila2018-01-071-192/+225
| | |/ / | | | | | | | | | | | | Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
| * | | l10n: vi.po(3288t): Updated Vietnamese translation for v2.16.0 round 2Tran Ngoc Quan2018-01-071-1929/+2156
| |/ / | | | | | | | | | Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
| * | l10n: git.pot: v2.16.0 round 2 (8 new, 4 removed)Jiang Xin2018-01-071-173/+192
| | | | | | | | | | | | | | | | | | Generate po/git.pot from v2.16.0-rc1 for git v2.16.0 l10n round 2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| * | Merge branch 'master' of git://github.com/git-l10n/git-poJiang Xin2018-01-078-10292/+11238
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'master' of git://github.com/git-l10n/git-po: l10n: es.po: Update Spanish Translation v2.16.0 l10n: fr.po v2.16.0 round 1 l10n: bg.po: Updated Bulgarian translation (3284t) l10n: sv.po: Update Swedish translation (3284t0f0u) l10n: fr.po: "worktree list" mistranslated as prune l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed) l10n: fixes to German translation l10n: Update Spanish translation l10n: zh_CN translate parameter name l10n: zh_CN Fix typo l10n: Fixes to Catalan translation
| | * \ Merge branch '2.16' of https://github.com/ChrisADR/git-poJiang Xin2018-01-061-1920/+2129
| | |\ \ | | | | | | | | | | | | | | | | | | | | * '2.16' of https://github.com/ChrisADR/git-po: l10n: es.po: Update Spanish Translation v2.16.0
| | | * | l10n: es.po: Update Spanish Translation v2.16.0Christopher Díaz Riveros2018-01-041-1920/+2129
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Christopher Díaz Riveros <chrisadr@gentoo.org>
| | * | | Merge branch 'fr_2.16' of git://github.com/jnavila/gitJiang Xin2018-01-061-1911/+2113
| | |\ \ \ | | | |/ / | | |/| | | | | | | | | | | | | | | | | * 'fr_2.16' of git://github.com/jnavila/git: l10n: fr.po v2.16.0 round 1 l10n: fr.po: "worktree list" mistranslated as prune
| | | * | l10n: fr.po v2.16.0 round 1Jean-Noel Avila2018-01-021-1910/+2112
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
| | | * | l10n: fr.po: "worktree list" mistranslated as pruneLouis Bettens2017-12-311-1/+1
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Louis Bettens <louis@bettens.info>
| | * | | Merge branch 'master' of git://github.com/alshopov/git-poJiang Xin2018-01-021-1934/+2106
| | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * 'master' of git://github.com/alshopov/git-po: l10n: bg.po: Updated Bulgarian translation (3284t)
| | | * | | l10n: bg.po: Updated Bulgarian translation (3284t)Alexander Shopov2018-01-011-1934/+2106
| | | |/ / | | | | | | | | | | | | | | | Signed-off-by: Alexander Shopov <ash@kambanaria.org>
| | * | | l10n: sv.po: Update Swedish translation (3284t0f0u)Peter Krefting2018-01-011-1910/+2118
| | |/ / | | | | | | | | | | | | | | | | | | | | Also corrected spelling. Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
| | * | Merge branch 'maint' of git://github.com/git-l10n/git-poJiang Xin2017-12-314-745/+746
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'maint' of git://github.com/git-l10n/git-po: l10n: fixes to German translation l10n: Update Spanish translation l10n: zh_CN translate parameter name l10n: zh_CN Fix typo l10n: Fixes to Catalan translation
| | | * | l10n: fixes to German translationRobert Abel2017-12-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Der-, die- and dasselbe and their declensions are spelt as one word in German. Signed-off-by: Robert Abel <rabel@robertabel.eu> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
| | | * | Merge branch '2.15.1' of https://github.com/ChrisADR/git-po into maintJiang Xin2017-12-051-531/+534
| | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | * '2.15.1' of https://github.com/ChrisADR/git-po: l10n: Update Spanish translation
| | | | * | l10n: Update Spanish translationChristopher Díaz Riveros2017-12-041-531/+534
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Christopher Díaz Riveros <chrisadr@gentoo.org>
| | | * | | l10n: zh_CN translate parameter nameFangyi Zhou2017-12-031-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Translate parameters such as: * <new-branch-name> in advice.c:126, * <command>, <path>, <revision> in setup.c:171, setup.c:184, setup.c:252, * <base-commit-id> in builtin/log.c:1288, * <conflicted_files> in git-rebase.sh:58, and more... Signed-off-by: Fangyi Zhou <fangyi.zhou@yuriko.moe> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| | | * | | l10n: zh_CN Fix typoZhou Fangyi2017-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | apply.c:125 say -> way Signed-off-by: Fangyi Zhou <fangyi.zhou@yuriko.moe>
| | | * | | l10n: Fixes to Catalan translationJordi Mas2017-11-041-193/+191
| | | |/ / | | | | | | | | | | | | | | | Signed-off-by: Jordi Mas <jmas@softcatala.org>
| | * | | l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed)Jiang Xin2017-12-311-1885/+2039
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generate po/git.pot from v2.16.0-rc0 for git v2.16.0 l10n round 1. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
* | | | | RelNotes: minor typofixSZEDER Gábor2018-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Git 2.16-rc2v2.16.0-rc2Junio C Hamano2018-01-111-1/+1
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'jh/object-filtering'Junio C Hamano2018-01-111-1/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hotfix for a topic already in 'master'. * jh/object-filtering: oidset: don't return value from oidset_init