summaryrefslogtreecommitdiff
path: root/Utility
Commit message (Collapse)AuthorAge
* avoid the dashed ssh hostname class of security holesGravatar Joey Hess2017-08-17
| | | | | | | | | | | | | | | | | | | | | | | | Security fix: Disallow hostname starting with a dash, which would get passed to ssh and be treated an option. This could be used by an attacker who provides a crafted ssh url (for eg a git remote) to execute arbitrary code via ssh -oProxyCommand. No CVE has yet been assigned for this hole. The same class of security hole recently affected git itself, CVE-2017-1000117. Method: Identified all places where ssh is run, by git grep '"ssh"' Converted them all to use a SshHost, if they did not already, for specifying the hostname. SshHost was made a data type with a smart constructor, which rejects hostnames starting with '-'. Note that git-annex already contains extensive use of Utility.SafeCommand, which fixes a similar class of problem where a filename starting with a dash gets passed to a program which treats it as an option. This commit was sponsored by Jochen Bartl on Patreon.
* fix build with old http-client versionsGravatar Joey Hess2017-08-17
|
* make import work with Win32 instead of Win32-extrasGravatar Joey Hess2017-08-16
|
* Disable http-client's default 30 second response timeout when HEADing an url ↵Gravatar Joey Hess2017-08-15
| | | | to check if it exists. Some web servers take quite a long time to answer a HEAD request.
* test: Avoid most situations involving failure to delete test directoriesGravatar Joey Hess2017-08-14
| | | | | | | | | | | | | | | | | | | By forking a worker process and only deleting the test directory once it exits. This way, if a test leaves files open, they'll get closed when the worker exits, so avoiding failure to delete open files on Windows, and failure to delete directories due to NFS lock files. If a test leaves a git worker process running, the closed pipes should cause the worker to exit too, also avoiding the problem there. The 10 second sleep ought to give plenty of time for such worker processes to exit, although this is of course a race. Finally, even if test directory fails to be deleted still, it won't appear as if the last test in the test suite failed; the error will be displayed at the very end. This commit was supported by the NSF-funded DataLad project.
* fix failing quickcheck propertiesGravatar Joey Hess2017-06-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QuickCheck 2.10 found a counterexample eg "\929184" broke the property. As far as I can tell, Git.Filename is matching how git handles encoding of strange high unicode characters in filenames for display. Git does not display high unicode characters, and instead displays the C-style escaped form of each byte. This is ambiguous, but since git is not unicode aware, it doesn't need to roundtrip parse it. So, making Git.FileName's roundtrip test only chars < 256 seems fine. Utility.Format.format uses encode_c, in order to mimic git, so that's ok. Utility.Format.gen uses decode_c, but only so that stuff like "\n" in the format string is handled. If the format string contains C-style octal escapes, they will be converted to ascii characters, and not combined into unicode characters, but that should not be a problem. If the user wants unicode characters, they can include them in the format string, without escaping them. Finally, decode_c is used by Utility.Gpg.secretKeys, because gpg --with-colons hex-escapes some characters in particular ':' and '\\'. gpg passes unicode through, so this use of decode_c is not a problem. This commit was sponsored by Henrik Riomar on Patreon.
* Fix build with QuickCheck 2.10.Gravatar Joey Hess2017-06-17
| | | | | | | | QuickCheck added an Arbitrary instance for CTime aka EpochTime. However, while git-annex's instance disallowed times before the epoch, QuickCheck's does not. So, rather than using its instance, convert from an Integer. This commit was sponsored by Thomas Hochstein on Patreon.
* disable closingTracked on OSXGravatar Joey Hess2017-06-09
| | | | | | | | Don't trust OSX FSEvents's eventFlagItemModified to be called when the last writer of a file closes it; apparently that sometimes does not happen, which prevented files from being quickly added. This commit was sponsored by John Peloquin on Patreon.
* remove temp file in failure caseGravatar Joey Hess2017-06-06
|
* Fix bug that prevented transfer locks from working when run on SMB or other ↵Gravatar Joey Hess2017-06-06
| | | | | | filesystem that does not support fcntl locks and hard links. This commit was sponsored by Ethan Aubin.
* Fix transfer log file locking problem when running concurrent transfers.Gravatar Joey Hess2017-05-25
| | | | | | | | | | | | | | orElse is great, but was not the right thing to use here because waitTakeLock could retry for other reasons than the lock being held, which made tryTakeLock fail when it shouldn't. Instead, move the code to tryTakeLock and implement waitTakeLock using tryTakeLock and retry. (Also, in runTransfer, when checkSaneLock fails, dropLock to avoid leaking a lock handle.) This commit was supported by the NSF-funded DataLad project.
* Improve progress display when watching file size, in cases where a transfer ↵Gravatar Joey Hess2017-05-25
| | | | | | does not resume. This commit was supported by the NSF-funded DataLad project.
* tighten forced subkey matchingGravatar Joey Hess2017-05-24
| | | | Someone might have a name or email address ending in a bang..
* initremote, enableremote: Support gpg subkeys suffixed with an exclamation ↵Gravatar Joey Hess2017-05-24
| | | | | | mark, which forces gpg to use a specific subkey. This commit was sponsored by Peter Hogg on Patreon.
* optimisationGravatar Joey Hess2017-05-16
| | | | Avoids N^2 list traversal.
* adeiu, MissingHGravatar Joey Hess2017-05-16
| | | | | | | | | | | | | | | | Removed dependency on MissingH, instead depending on the split library. After laying groundwork for this since 2015, it was mostly straightforward. Added Utility.Tuple and Utility.Split. Eyeballed System.Path.WildMatch while implementing the same thing. Since MissingH's progress meter display was being used, I re-implemented my own. Bonus: Now progress is displayed for transfers of files of unknown size. This commit was sponsored by Shane-o on Patreon.
* stop using MissingH for MD5Gravatar Joey Hess2017-05-15
| | | | | | | | | | Cryptonite is faster and allocates less, and I want to get rid of MissingH use. Note that the new dependency on memory is free; it's a dependency of cryptonite. This commit was supported by the NSF-funded DataLad project.
* remove absNormPathUnix againGravatar Joey Hess2017-05-15
| | | | | | | | | | | | | | | | | Moving toward dropping MissingH dep. I think I've addressed the problem identified earlier in 7141943075211f9dd4959ca4c8b0a274f48dc9ff. On Windows, absPathFrom "/tmp/repo/xxx" "y/bar" would be "/tmp/repo/xxx\\y/bar", which then confuses relPathDirToFile. Fixed by converting to unix (git) style paths. Also, relPathDirToFile was splitting only on \\ on windows and not / which broke the example in 7141943075211f9dd4959ca4c8b0a274f48dc9ff of relPathDirToFile (absPathFrom "/tmp/repo/xxx" "y/bar") "/tmp/repo/.git/annex/objects/xxx" Now, on windows, that will yield "..\\..\\..\\.git/annex/objects/xxx" which once converted to unix style paths is what we want.
* multicast: New command, uses uftp to multicast annexed files, for eg a ↵Gravatar Joey Hess2017-03-30
| | | | | | classroom setting. This commit was supported by the NSF-funded DataLad project.
* Windows: Fix bug in shell script shebang lookup code that caused a "delayed ↵Gravatar Joey Hess2017-03-13
| | | | | | | | | read on closed handle" error. The bug was that withFile closes the handle afterwards, but the content of the file was not read due to laziness. Using readFile avoids it. This commit was sponsored by Nick Daly on Patreon.
* Drop support for building with old versions of directory, feed, and http-types.Gravatar Joey Hess2017-03-10
|
* Drop support for building with old versions of dns and http-conduit.Gravatar Joey Hess2017-03-10
|
* relicense Utility/GPG.hs BSD as the rest of Utility isGravatar Joey Hess2017-03-10
| | | | | | | | | | The COPYRIGHT had Utility/DirWatcher* listed as GPL, but they were actually BSD licensed. No idea why I put the GPL on Utility/GPG.hs file originally. I wrote all of it, except for guilhem's small changes to it in a7f50205bb1ccd41d4a9ab4e11d984e643be755f, which seem too small to be independently copyrightable. I'm relicencing it BSD.
* Windows: Improve handling of shebang in external special remote program, ↵Gravatar Joey Hess2017-03-08
| | | | | | | | | | | | | | | | | | | searching for the program in the PATH. findShellCommand needs a full path to a file in order to check it for a shebang on Windows. It was being run with only the base name of the external special remote program, which would only work when it was in the current directory. This is why users in https://github.com/DanielDent/git-annex-remote-rclone/pull/10 and elsewhere were complaining that the previous improvements to git-annex didn't make git-remote-rclone work on Windows. Also, reworked checkearlytermination, which while it worked, seemed to rely on a race condition. And, improved its error messages. This commit was sponsored by Shane-o on Patreon.
* Removed support for building with the old cryptohash library.Gravatar Joey Hess2017-02-24
| | | | | Building with that library made git-annex not support SHA3; it's time for that to always be supported in case SHA2 dominoes.
* make curl show http errors to stderrGravatar Joey Hess2017-02-20
| | | | | | | | | | | | | * Run curl with -S, so HTTP errors are displayed, even when it's otherwise silent. * When downloading in --json or --quiet mode, use curl in preference to wget, since curl is able to display only errors to stderr, unlike wget. This does mean that downloadQuiet is only silent on stdout, not necessarily on stderr, which affects a couple other calls of it. For example, downloading the .git/config of a http remote may show an error message now, perhaps with slightly suboptimal formatting due to other output.
* improve layoutGravatar Joey Hess2017-02-20
|
* Run wget with -nv instead of -q, so it will display HTTP errors.Gravatar Joey Hess2017-02-20
| | | | | | This adds one extra line of output when a download is successful, after the progress bar. I don't much like that, but wget does not provide a way to show HTTP errors without it.
* simpler more generic processTranscript'Gravatar Joey Hess2017-02-15
| | | | | | | | This allows using functions that generate CreateProcess and passing the result to processTranscript', which is more flexible, and also simpler than the old interface. This commit was sponsored by Riku Voipio.
* Work around sqlite's incorrect handling of umask when creating databases.Gravatar Joey Hess2017-02-13
| | | | | | | | | Refactored some common code into initDb. This only deals with the problem when creating new databases. If a repo got bad permissions into it, it's up to the user to deal with it. This commit was sponsored by Ole-Morten Duesund on Patreon.
* correct spelling mistakesGravatar Edward Betts2017-02-12
|
* Improve pid locking code to work on filesystems that don't support hard links.Gravatar Joey Hess2017-02-10
| | | | | | | | | | Probing for hard link support in the pid locking code is redundant since git-annex init already probes that. But, it didn't seem worth threading that data through; the pid locking code runs at most once per git-annex process, and only on unusual filesystems. Optimising a single hard link and unlink isn't worth it. This commit was sponsored by Francois Marier on Patreon.
* wormhole pairing appid flag day 2021-12-31Gravatar Joey Hess2017-02-03
| | | | | | | | | | | | Wormhole pairing will start to provide an appid to wormhole on 2021-12-31. An appid can't be provided now because Debian stable is going to ship a older version of git-annex that does not provide an appid. Assumption is that by 2021-12-31, this version of git-annex will be shipped in a Debian stable release. If that turns out to not be the case, this change will need to be cherry-picked into the git-annex in Debian stable, or its wormhole pairing will break. This commit was sponsored by Thomas Hochstein on Patreon.
* Some optimisations to string splitting code.Gravatar Joey Hess2017-01-31
| | | | | | | | | | | | | | | | | | | Turns out that Data.List.Utils.split is slow and makes a lot of allocations. Here's a much simpler single character splitter that behaves the same (even in wacky corner cases) while running in half the time and 75% the allocations. As well as being an optimisation, this helps move toward eliminating use of missingh. (Data.List.Split.splitOn is nearly as slow as Data.List.Utils.split and allocates even more.) I have not benchmarked the effect on git-annex, but would not be surprised to see some parsing of eg, large streams from git commands run twice as fast, and possibly in less memory. This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.
* work around ghc segfaultGravatar Joey Hess2016-12-30
| | | | | | | | | | | | | hSetEncoding of a closed handle segfaults. https://ghc.haskell.org/trac/ghc/ticket/7161 3b9d9a267b7c9247d36d9b622e1b836724ca5fb0 introduced the crash. In particular, stdin may get closed (by eg, getContents) and then trying to set its encoding will crash. We didn't need to adjust stdin's encoding anyway, but only stderr, to work around https://github.com/yesodweb/persistent/issues/474 Thanks to Mesar Hameed for assistance related to reproducing this bug.
* more windows build fixGravatar Joey Hess2016-12-30
|
* fix windows buildGravatar Joey Hess2016-12-30
|
* fix windows buildGravatar Joey Hess2016-12-30
|
* fix build with old ghcGravatar Joey Hess2016-12-30
|
* make this build under windowsGravatar Joey Hess2016-12-30
|
* improve description of password promptingGravatar Joey Hess2016-12-28
| | | | | | | | | Since the user does not know whether it will run su or sudo, indicate whether the password prompt will be for root or the user's password, when possible. I assume that programs like gksu that can prompt for either depending on system setup will make clear in their prompt what they're asking for.
* Support all common locations of the torrc file.Gravatar Joey Hess2016-12-28
|
* fix windows buildGravatar Joey Hess2016-12-28
|
* Merge branch 'no-xmpp'Gravatar Joey Hess2016-12-28
|\
* | whitespaceGravatar Joey Hess2016-12-28
| |
| * avoid leaving MVar emptyGravatar Joey Hess2016-12-27
| | | | | | | | Something might want to observe the code multiple times.
| * webapp: check that tor and magic wormhole are installedGravatar Joey Hess2016-12-24
| |
| * cleanupGravatar Joey Hess2016-12-24
|/
* Always use filesystem encoding for all file and handle reads and writes.Gravatar Joey Hess2016-12-24
| | | | | This is a big scary change. I have convinced myself it should be safe. I hope!
* really fix su commandGravatar Joey Hess2016-12-24
|