summaryrefslogtreecommitdiff
path: root/Utility
Commit message (Collapse)AuthorAge
* avoid chown call if the current file mode is same as newGravatar Joey Hess2012-04-21
| | | | | | | Not only an optimisation. fsck always tried to preventWrite to make sure file modes are good, and in a shared repo, that will fail on directories not owned by the current user. Although there may be other problems with such a setup.
* tweakGravatar Joey Hess2012-04-18
|
* clear errno after successful callGravatar Joey Hess2012-04-18
| | | | | | | | When preparing the debian stable backport, I am seeing a call to statvfs() succeed, but also set errno to 2 (ENOENT). Not sure why this happens; I am in a schroot when it does happen, or perhaps stable's libc is a little broken and sets errno incorrectly. Anyway, it should be perfectly fine to clear errno after the successful call, rather than before it.
* import jugglingGravatar Joey Hess2012-04-14
|
* Renamed diskfree.c to avoid OSX case insensativity bug.Gravatar Joey Hess2012-04-13
|
* allow add or del events to be ignoredGravatar Joey Hess2012-04-12
|
* allow excluding directories from being watchedGravatar Joey Hess2012-04-12
|
* don't fall over broken linksGravatar Joey Hess2012-04-12
|
* put in a warning so I remember to look at thisGravatar Joey Hess2012-04-12
|
* add waitForTerminationGravatar Joey Hess2012-04-11
|
* recursive inotify thingGravatar Joey Hess2012-04-11
| | | | | | | | | | | | | | | Recursive inotify has beaten me before, with its bad design and races, but not this time! (I think.) This is able to follow the strongest filesystem traffic I can throw at it, and robustly notices every file add and delete. Mostly that's down to Haskell having a quite nice threaded inotify library (that does its own buffering). A key insight was realizing that the inotify directory add race could be dealt with by scanning for files inside newly added directories. TODO: Add support for freebsd/osx kqueue; see http://hackage.haskell.org/package/kqueue Can a git-annex-monitor be far off?
* Disable diskfree on kfreebsd, as I have a build failure on kfreebsd-i386 ↵Gravatar Joey Hess2012-04-07
| | | | that is quite likely caused by it.
* use struct statfs64 on OSXGravatar Joey Hess2012-03-23
|
* tweakGravatar Joey Hess2012-03-22
|
* updateGravatar Joey Hess2012-03-22
|
* break out kfreebsdGravatar Joey Hess2012-03-22
| | | | Now tested on linux and freebsd (amd64).
* Rewrote free disk space checking codeGravatar Joey Hess2012-03-22
| | | | | Moving the portability handling into a small C library cleans up things a lot, avoiding the pain of unpacking structs from inside haskell code.
* fun with symbolsGravatar Joey Hess2012-03-17
| | | | | | Nothing at all on hackage is using <&&> or <||>. (Also, <&&> should short-circuit on failure.)
* optimize monadic ||Gravatar Joey Hess2012-03-16
| | | | | (||) used applicative style runs both conditions rather than short circuiting. Add an orM that properly short-circuits.
* simplifyGravatar Joey Hess2012-03-16
|
* nukes another 15 lines thanks to ifMGravatar Joey Hess2012-03-15
|
* added ifM and nuked 11 lines of codeGravatar Joey Hess2012-03-14
| | | | no behavior changes
* check hook executabilityGravatar Joey Hess2012-03-14
|
* moveGravatar Joey Hess2012-03-11
|
* perhaps more clear typeGravatar Joey Hess2012-03-10
|
* cleanupGravatar Joey Hess2012-03-09
|
* fix key directory hash calculation codeGravatar Joey Hess2012-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix Key directory hash calculation code to behave as it did before version 3.20120227 when a key contains non-ascii. The hash directories for a given Key are based on its md5sum. Prior to ghc 7.4, Keys contained raw, undecoded bytes, so the md5sum was taken of each byte in turn. With the ghc 7.4 filename encoding change, keys contains decoded unicode characters (possibly with surrigates for undecodable bytes). This changes the result of the md5sum, since the md5sum used is pure haskell and supports unicode. And that won't do, as git-annex will start looking in a different hash directory for the content of a key. The surrigates are particularly bad, since that's essentially a ghc implementation detail, so could change again at any time. Also, changing the locale changes how the bytes are decoded, which can also change the md5sum. Symptoms would include things like: * git annex fsck would complain that no copies existed of a file, despite its symlink pointing to the content that was locally present * git annex fix would change the symlink to use the wrong hash directory. Only WORM backend is likely to have been affected, since only it tends to include much filename data (SHA1E could in theory also be affected). I have not tried to support the hash directories used by git-annex versions 3.20120227 to 3.20120308, so things added with those versions with WORM will require manual fixups. Sorry for the inconvenience!
* factor out Utility.FileSystemEncodingGravatar Joey Hess2012-03-09
|
* refactorGravatar Joey Hess2012-03-09
|
* Fix a bug in symlink calculation code, that triggered in rare cases where an ↵Gravatar Joey Hess2012-03-05
| | | | | | | | | | | annexed file is in a subdirectory that nearly matched to the .git/annex/object/xx/yy subdirectories. This is a straight up pure-code stinker. The relative path calculation looked for common subdirectories in the two paths, but failed to stop after the paths diverged. When a later pair of subdirectories were the same, the resulting relative path was wrong. Added regression test for this.
* refactorGravatar Joey Hess2012-02-20
|
* hlintGravatar Joey Hess2012-02-16
|
* work around Network.Browser bug that converts a HEAD to a GET when following ↵Gravatar Joey Hess2012-02-10
| | | | | | | | | | | | | | | | | | | | | | a redirect The code explicitly switches from HEAD to GET for most redirects. Possibly because someone misread a spec (which does require switching from POST to GET for 303 redirects). Or possibly because the spec really is that bad. Upstream bug: https://github.com/haskell/HTTP/issues/24 Since we absolutely don't want to download entire (large) files from the web when checking that they exist with HEAD, I wrote my own redirect follower, based closely on the one used by Network.Browser, but without this misfeature. Note that Network.Browser checks that the redirect url is a http url and fails if not. I don't, because I want to not need to change this code when it gets https support (related: I'm surprised to see it doesn't support https yet..). The check does not seem security significant; it doesn't support file:// urls for example. If a http url is redirected to https, the Network.Browser will actually make a http connection again. This could loop, but only up to 5 times.
* When checking that an url has a key, verify that the Content-Length, if ↵Gravatar Joey Hess2012-02-10
| | | | | | | | available, matches the size of the key. If there's no Content-Length, or the key has no size, this check is not done, but it should happen most of the time, and protect against web content that has changed.
* really fix foreign C functions filename encodingsGravatar Joey Hess2012-02-04
| | | | GHC should probably export withFilePath.
* fix touch and statfs to work on any files in any localeGravatar Joey Hess2012-02-04
| | | | | | | Use withCAString rather than withCString. XXX Actually, this only works in non-unicode locales when presented with unicode characters. Help?
* Merge branch 'master' into ghc7.4Gravatar Joey Hess2012-02-03
|\ | | | | | | | | Conflicts: Utility/Misc.hs
| * IO exception reworkGravatar Joey Hess2012-02-03
| | | | | | | | | | | | ghc 7.4 comaplains about use of System.IO.Error to catch exceptions. Ok, use Control.Exception, with variants specialized to only catch IO exceptions.
* | support all filename encodings with ghc 7.4Gravatar Joey Hess2012-02-03
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under ghc 7.4, this seems to be able to handle all filename encodings again. Including filename encodings that do not match the LANG setting. I think this will not work with earlier versions of ghc, it uses some ghc internals. Turns out that ghc 7.4 has a special filesystem encoding that it uses when reading/writing filenames (as FilePaths). This encoding is documented to allow "arbitrary undecodable bytes to be round-tripped through it". So, to get FilePaths from eg, git ls-files, set the Handle that is reading from git to use this encoding. Then things basically just work. However, I have not found a way to make Text read using this encoding. Text really does assume unicode. So I had to switch back to using String when reading/writing data to git. Which is a pity, because it's some percent slower, but at least it works. Note that stdout and stderr also have to be set to this encoding, or printing out filenames that contain undecodable bytes causes a crash. IMHO this is a misfeature in ghc, that the user can pass you a filename, which you can readFile, etc, but that default, putStr of filename may cause a crash! Git.CheckAttr gave me special trouble, because the filenames I got back from git, after feeding them in, had further encoding breakage. Rather than try to deal with that, I just zip up the input filenames with the attributes. Which must be returned in the same order queried for this to work. Also of note is an apparent GHC bug I worked around in Git.CheckAttr. It used to forkProcess and feed git from the child process. Unfortunatly, after this forkProcess, accessing the `files` variable from the parent returns []. Not the value that was passed into the function. This screams of a bad bug, that's clobbering a variable, but for now I just avoid forkProcess there to work around it. That forkProcess was itself only added because of a ghc bug, #624389. I've confirmed that the test case for that bug doesn't reproduce it with ghc 7.4. So that's ok, except for the new ghc bug I have not isolated and reported. Why does this simple bit of code magnet the ghc bugs? :) Also, the symlink touching code is currently broken, when used on utf-8 filenames in a non-utf-8 locale, or probably on any filename containing undecodable bytes, and I temporarily commented it out.
* switch to the strict state monadGravatar Joey Hess2012-01-29
| | | | | | | | | | I had not realized what a memory leak the lazy state monad could be, although I have not seen much evidence of actual leaking in git-annex. However, if running git-annex on a great many files, this could matter. The additional Utility.State.changeState adds even more strictness, avoiding a problem I saw in github-backup where repeatedly modifying state built up a huge pile of thunks.
* remove Utility.Conditional and use IfElseGravatar Joey Hess2012-01-24
| | | | | | | This drops the >>! and >>? with the nice low fixity. IfElse does have undocumented >>=>>! and >>=>>? operators, but I deem that too fishy. Anyway, using whenM and unlessM is easier; I sometimes mixed the operators up.
* rename readMaybe to readishGravatar Joey Hess2012-01-23
| | | | a stricter (but also partial) readMaybe is getting added to base
* a few things available elsewhere...Gravatar Joey Hess2012-01-23
|
* treakGravatar Joey Hess2012-01-21
|
* typoGravatar Joey Hess2012-01-20
|
* Add a sanity check for bad StatFS results.Gravatar Joey Hess2012-01-14
| | | | | | | | | | | | | | | git-annex FTBFS on s390, mips, powerpc, sparc. That StatFS code is failing on all of them. At least on s390, the failure appears as: Just (FileSystemStats {fsStatBlockSize = 4096, fsStatBlockCount = 0, fsStatByteCount = 0, fsStatBytesFree = 0, fsStatBytesAvailable = 0, fsStatBytesUsed = 0}) While I don't understand why this is happening, or how to fix it, bandaid over it by checking for obviously bad values and returning Nothing. That disables disk free space checking, but at least git-annex will work. Upstream bug: http://code.google.com/p/xmobar/issues/detail?id=70
* don't use GPG_AGENT_INFO to force batch mode in test suiteGravatar Joey Hess2012-01-09
| | | | | | | | Fails with gpg 2. Instead, use a different environment variable. The clean fix would instead be to add an annex.gpg-options configuration. But, that would be rather a lot of work and it's unlikely it would be useful for much else.
* Fix overbroad gpg --no-tty fix from last release.Gravatar Joey Hess2012-01-07
| | | | | | | Only set --no-tty when GPG_AGENT_INFO is set and batch mode is used. In the test suite, set GPG_AGENT_INFO to /dev/null to avoid the test suite relying on /dev/tty.
* Run gpg with --no-tty. Closes: #654721Gravatar Joey Hess2012-01-05
|
* typoGravatar Joey Hess2012-01-03
|