{"thread":{"id":"57749","subject":"Git bug report - disk errors on Windows after push","startedAt":"2022-04-18T08:40:26Z","lastAt":"2022-04-22T16:13:37Z","messageCount":10,"participants":["Attila Csosz","brian m. carlson","Neeraj Singh","Ævar Arnfjörð Bjarmason","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"453802","messageId":"4026b85f-8cae-bcca-af14-e886e80725d4@designsoftware.com","threadId":"57749","inReplyTo":null,"subject":"Git bug report - disk errors on Windows after push","fromName":"Attila Csosz","fromEmail":"csosza@designsoftware.com","sentAt":"2022-04-18T07:47:07Z","receivedAt":"2022-04-18T08:40:26Z","isPatch":false,"sender":{"key":"csosza@designsoftware.com","avatar":null},"body":"Thank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\nPushing to a directory directly.\n\nWhat did you expect to happen? (Expected behavior)\nGood behavior\n\nWhat happened instead? (Actual behavior)\nDisk errors. After pushing to a directory (my origin field is C:\\Work \nfor example) the git repository will be corrupted.\nMoreover causing disk errors not only in the target git bare repository. \nI've loosed some other files.\nCannot be reproduced exactly. However I have decided to report this \nproblem.\nI've experienced this problem for several years.\n\nWhat's different between what you expected and what actually happened?\nDescribed.\n\nAnything else you want to add:\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.31.1.windows.1\ncpu: x86_64\nbuilt from commit: c5f0be26a7e3846e3b6268d1c6c4800d838c6bbb\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Windows 10.0 19044\ncompiler info: gnuc: 10.2\nlibc info: no libc information available\n$SHELL (typically, interactive shell): C:\\Program Files\\Git\\usr\\bin\\bash.exe\n\n\n[Enabled Hooks]\n\n\n"},{"id":"453895","messageId":"Yl2h5I0apzWhpVtr@camp.crustytoothpaste.net","threadId":"57749","inReplyTo":"4026b85f-8cae-bcca-af14-e886e80725d4@designsoftware.com","subject":"Re: Git bug report - disk errors on Windows after push","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2022-04-18T17:37:40Z","receivedAt":"2022-04-18T17:37:48Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Hey,\n\nOn 2022-04-18 at 07:47:07, Attila Csosz wrote:\n> Thank you for filling out a Git bug report!\n> Please answer the following questions to help us understand your issue.\n> \n> What did you do before the bug happened? (Steps to reproduce your issue)\n> Pushing to a directory directly.\n> \n> What did you expect to happen? (Expected behavior)\n> Good behavior\n> \n> What happened instead? (Actual behavior)\n> Disk errors. After pushing to a directory (my origin field is C:\\Work for\n> example) the git repository will be corrupted.\n> Moreover causing disk errors not only in the target git bare repository.\n> I've loosed some other files.\n> Cannot be reproduced exactly. However I have decided to report this problem.\n> I've experienced this problem for several years.\n\nThere's nothing that Git should be able to do as a normal operating\nsystem that causes disk errors.  If you're seeing those kinds of errors,\nthe likelihood is that your disk is bad and you need to replace it.\n\nDo note that if you're storing your data in a directory managed by a\ncloud syncing service (e.g., Dropbox or OneDrive), then it is known that\nthose file systems corrupt Git repositories and you shouldn't use them\nwith Git.  That's due to the way they sync data.\n\nHowever, if this is a regular file system (e.g., NTFS), then Git\nshouldn't be able to cause disk problems, and if it could, that would be\na serious defect in Windows, so it's almost certainly going to be a\nhardware problem.\n-- \nbrian m. carlson (he/him or they/them)\nToronto, Ontario, CA\n"},{"id":"453915","messageId":"fa40a6e6-dd83-9e88-e2f7-ab8aff2ca5a4@designsoftware.com","threadId":"57749","inReplyTo":"Yl2h5I0apzWhpVtr@camp.crustytoothpaste.net","subject":"Re: Git bug report - disk errors on Windows after push","fromName":"Attila Csosz","fromEmail":"csosza@designsoftware.com","sentAt":"2022-04-19T03:52:23Z","receivedAt":"2022-04-19T04:14:44Z","isPatch":false,"sender":{"key":"csosza@designsoftware.com","avatar":null},"body":"I've experienced the problem at least 3 different external disk.\nI'm not using cloud syncing service (e.g., Dropbox or OneDrive) for git.\n\nAttila\n\nOn 4/18/2022 19:37, brian m. carlson wrote:\n> Hey,\n>\n> On 2022-04-18 at 07:47:07, Attila Csosz wrote:\n>> Thank you for filling out a Git bug report!\n>> Please answer the following questions to help us understand your issue.\n>>\n>> What did you do before the bug happened? (Steps to reproduce your issue)\n>> Pushing to a directory directly.\n>>\n>> What did you expect to happen? (Expected behavior)\n>> Good behavior\n>>\n>> What happened instead? (Actual behavior)\n>> Disk errors. After pushing to a directory (my origin field is C:\\Work for\n>> example) the git repository will be corrupted.\n>> Moreover causing disk errors not only in the target git bare repository.\n>> I've loosed some other files.\n>> Cannot be reproduced exactly. However I have decided to report this problem.\n>> I've experienced this problem for several years.\n> There's nothing that Git should be able to do as a normal operating\n> system that causes disk errors.  If you're seeing those kinds of errors,\n> the likelihood is that your disk is bad and you need to replace it.\n>\n> Do note that if you're storing your data in a directory managed by a\n> cloud syncing service (e.g., Dropbox or OneDrive), then it is known that\n> those file systems corrupt Git repositories and you shouldn't use them\n> with Git.  That's due to the way they sync data.\n>\n> However, if this is a regular file system (e.g., NTFS), then Git\n> shouldn't be able to cause disk problems, and if it could, that would be\n> a serious defect in Windows, so it's almost certainly going to be a\n> hardware problem.\n"},{"id":"454035","messageId":"YmB686xgnjF86F+H@camp.crustytoothpaste.net","threadId":"57749","inReplyTo":"fa40a6e6-dd83-9e88-e2f7-ab8aff2ca5a4@designsoftware.com","subject":"Re: Git bug report - disk errors on Windows after push","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2022-04-20T21:28:19Z","receivedAt":"2022-04-20T21:28:29Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"[Please avoid top-posting on this list.]\n\nOn 2022-04-19 at 03:52:23, Attila Csosz wrote:\n> I've experienced the problem at least 3 different external disk.\n> I'm not using cloud syncing service (e.g., Dropbox or OneDrive) for git.\n\nI don't doubt that's the case.  However, it's not possible for Git to\ncorrupt a disk just by writing to it.  Git, as a normal unprivileged\nprogram, can only open files and perform normal read and write\noperations on them.  Management of the file system, including integrity,\nis the responsibility of the operating system.  If running Git on\nWindows causes files outside of the repository to be corrupted, that's\neither a hardware problem or a bug in Windows.\n\nIf you're seeing this problem, it could be that you have a series of bad\ndisks (say, if you bought a set of cheap flash drives), that the drive\nisn't being removed properly, that you have some sort of broken driver\nor malware, that there's some other hardware problem (e.g., a bad dock,\nUSB device, CPU, or memory), or just that there's a previously unknown\nbug in Windows.\n\nNone of this is Git's fault, and it's really up to you to figure out\nwhich of these it is.  You might try isolating it by using a different\ncomputer to write to the repository first, to see if something about\nyour current machine is the problem, and then try isolating other\ncauses.\n-- \nbrian m. carlson (he/him or they/them)\nToronto, Ontario, CA\n"},{"id":"454040","messageId":"04a50f96-363f-210f-b894-11945d0eb3e8@gmail.com","threadId":"57749","inReplyTo":"fa40a6e6-dd83-9e88-e2f7-ab8aff2ca5a4@designsoftware.com","subject":"Re: Git bug report - disk errors on Windows after push","fromName":"Neeraj Singh","fromEmail":"nksingh85@gmail.com","sentAt":"2022-04-20T22:54:24Z","receivedAt":"2022-04-20T22:54:29Z","isPatch":false,"sender":{"key":"nksingh85@gmail.com","avatar":null},"body":"On 4/18/2022 8:52 PM, Attila Csosz wrote:\n> I've experienced the problem at least 3 different external disk.\n> I'm not using cloud syncing service (e.g., Dropbox or OneDrive) for git.\n> \n> Attila\n> \nHi Attila,\nCould you please share a bit more information about the disks that are \nbeing corrupted and the specific error messages you're seeing?\n\nWhat is the underlying storage type (e.g. USB key, external hard drive,\netc)?  Also, which filesystem is the drive formatted as?\n\nCould you please save one instance of a volume in the corrupted state so \nthat we can consider further investigations?\n\nI believe the output of \"fsutil fsinfo volumeinfo <drive letter>\" and\n\"fsutil fsinfo drivetype <drive letter>\" should give us some useful info \nabout the volume that's being corrupted.\n\nThanks,\nNeeraj Singh,\nWindows FileSystem Dev\n"},{"id":"454047","messageId":"CAMYm8FoA55JwXezckJxMPXGLh2+osCwsHHrg_MSjLMqG2emygQ@mail.gmail.com","threadId":"57749","inReplyTo":"04a50f96-363f-210f-b894-11945d0eb3e8@gmail.com","subject":"Re: Git bug report - disk errors on Windows after push","fromName":"Attila Csosz","fromEmail":"csosza@designsoftware.com","sentAt":"2022-04-21T02:29:03Z","receivedAt":"2022-04-21T02:53:57Z","isPatch":false,"sender":{"key":"csosza@designsoftware.com","avatar":null},"body":"Please check this link also\nhttps://github.community/t/what-could-be-the-reason-my-git-repositories-keep-getting-corrupted-broken/184711\n\nYou can found many link on web on 'git corrupted repository'. In my\nopinion when a git repository is corrupted on Windows there is a good\nchance to HDD errors.\n\nI suggest also run intensive test on Windows (run a bat file commiting\nand pushing to a bare directory type repository). Check your HDD\nhealthy status after 10-20 run of 'git push'.\n\nMy git software is come form 'git-scm.com' and I'm using TortoiseGit.\nMy git software is up to date.\nLast time my laptop HDD is crashed loosing sensitive datas. I will\nnever push to a local repo I'm using online repo-s like github.\n\n///\nfsutil fsinfo volumeinfo e:\nVolume Name : Seagate Backup Plus Drive\nVolume Serial Number : <removed by hand>\nMax Component Length : 255\nFile System Name : NTFS\nIs ReadWrite\nNot Thinly-Provisioned\nSupports Case-sensitive filenames\nPreserves Case of filenames\nSupports Unicode in filenames\nPreserves & Enforces ACL's\nSupports file-based Compression\nSupports Disk Quotas\nSupports Sparse files\nSupports Reparse Points\nReturns Handle Close Result Information\nSupports POSIX-style Unlink and Rename\nSupports Object Identifiers\nSupports Encrypted File System\nSupports Named Streams\nSupports Transactions\nSupports Hard Links\nSupports Extended Attributes\nSupports Open By FileID\nSupports USN Journal\n///\n\nMaybe this email not reaching the main mailing list I'm somehow blacklisted.\n\n\nAttila\n\nOn Thu, Apr 21, 2022 at 12:54 AM Neeraj Singh <nksingh85@gmail.com> wrote:\n>\n> On 4/18/2022 8:52 PM, Attila Csosz wrote:\n> > I've experienced the problem at least 3 different external disk.\n> > I'm not using cloud syncing service (e.g., Dropbox or OneDrive) for git.\n> >\n> > Attila\n> >\n> Hi Attila,\n> Could you please share a bit more information about the disks that are\n> being corrupted and the specific error messages you're seeing?\n>\n> What is the underlying storage type (e.g. USB key, external hard drive,\n> etc)?  Also, which filesystem is the drive formatted as?\n>\n> Could you please save one instance of a volume in the corrupted state so\n> that we can consider further investigations?\n>\n> I believe the output of \"fsutil fsinfo volumeinfo <drive letter>\" and\n> \"fsutil fsinfo drivetype <drive letter>\" should give us some useful info\n> about the volume that's being corrupted.\n>\n> Thanks,\n> Neeraj Singh,\n> Windows FileSystem Dev\n"},{"id":"454166","messageId":"51a685bf-3cd1-b573-535c-e18b2f987d66@gmail.com","threadId":"57749","inReplyTo":"CAMYm8FoA55JwXezckJxMPXGLh2+osCwsHHrg_MSjLMqG2emygQ@mail.gmail.com","subject":"Re: Git bug report - disk errors on Windows after push","fromName":"Neeraj Singh","fromEmail":"nksingh85@gmail.com","sentAt":"2022-04-21T20:08:31Z","receivedAt":"2022-04-21T20:08:56Z","isPatch":false,"sender":{"key":"nksingh85@gmail.com","avatar":null},"body":"On 4/20/2022 7:29 PM, Attila Csosz wrote:\n> Please check this link also\n> https://github.community/t/what-could-be-the-reason-my-git-repositories-keep-getting-corrupted-broken/184711\n> \n> You can found many link on web on 'git corrupted repository'. In my\n> opinion when a git repository is corrupted on Windows there is a good\n> chance to HDD errors.\n> \n> I suggest also run intensive test on Windows (run a bat file commiting\n> and pushing to a bare directory type repository). Check your HDD\n> healthy status after 10-20 run of 'git push'.\n> \n> My git software is come form 'git-scm.com' and I'm using TortoiseGit.\n> My git software is up to date.\n> Last time my laptop HDD is crashed loosing sensitive datas. I will\n> never push to a local repo I'm using online repo-s like github.\n> \n\nDo you currently have a drive in the bad state? Is write-caching enabled \nfor the drive \n(https://docs.microsoft.com/en-us/troubleshoot/windows-server/backup-and-storage/turn-disk-write-caching-on-off)?\n\nGit hammers the filesystem in a way that's not typically done for a USB \ndrive (especially issuing some \"FlushFileBuffers\" calls).  So it \npossibly exposes some inherent flakiness in your setup. For instance, \nyour drives might be good, but something could be wrong with your USB \ncable or the power supply.\n\nIf you have a drive in the bad state, a \"chkdsk /scan /X <drive letter>\" \nmight give some hints about what specifically is wrong with that filesystem.\n\nI'd recommend preferring a cloud-based backup system for your Git repos \n(e.g. GitHub or GitLab).  Also, for local backups, something solid-state \nlike an SSD might be more reliable in the long run.\n\nThanks,\nNeeraj\n"},{"id":"454241","messageId":"220422.868rrx5uju.gmgdl@evledraar.gmail.com","threadId":"57749","inReplyTo":"Yl2h5I0apzWhpVtr@camp.crustytoothpaste.net","subject":"Re: Git bug report - disk errors on Windows after push","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-22T09:27:23Z","receivedAt":"2022-04-22T09:36:27Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Mon, Apr 18 2022, brian m. carlson wrote:\n\n> [[PGP Signed Part:Undecided]]\n> Hey,\n>\n> On 2022-04-18 at 07:47:07, Attila Csosz wrote:\n>> Thank you for filling out a Git bug report!\n>> Please answer the following questions to help us understand your issue.\n>> \n>> What did you do before the bug happened? (Steps to reproduce your issue)\n>> Pushing to a directory directly.\n>> \n>> What did you expect to happen? (Expected behavior)\n>> Good behavior\n>> \n>> What happened instead? (Actual behavior)\n>> Disk errors. After pushing to a directory (my origin field is C:\\Work for\n>> example) the git repository will be corrupted.\n>> Moreover causing disk errors not only in the target git bare repository.\n>> I've loosed some other files.\n>> Cannot be reproduced exactly. However I have decided to report this problem.\n>> I've experienced this problem for several years.\n>\n> There's nothing that Git should be able to do as a normal operating\n> system that causes disk errors.  If you're seeing those kinds of errors,\n> the likelihood is that your disk is bad and you need to replace it.\n>\n> Do note that if you're storing your data in a directory managed by a\n> cloud syncing service (e.g., Dropbox or OneDrive), then it is known that\n> those file systems corrupt Git repositories and you shouldn't use them\n> with Git.  That's due to the way they sync data.\n>\n> However, if this is a regular file system (e.g., NTFS), then Git\n> shouldn't be able to cause disk problems, and if it could, that would be\n> a serious defect in Windows, so it's almost certainly going to be a\n> hardware problem.\n\nI think you're most likely right that this is some local HW issue, but\nthe report doesn't have enough information to say either way.\n\nBut generally as we've been discussing at length in various threads\nrelated to git's fsync() behavior we can and will corrupt repositories\ndue only to our own (mis)use of FS APIs, i.e. not doing fsyncing and the\nlike correctly, it's been improved a bit recently.\n\nBut we're still in a state of not doing it correctly, and/or relying on\nsome implicit assumptions.\n\nFor something like an external disk that may have its power cable yanked\nI'd give it about even odds that it's HW v.s. git's own FS syncing logic\nbeing at fault.\n\nWe get away with a lot of shenanigans because we're usually on a\njournaled FS, which e.g. on a FAT32 external volume we won't benefit\nfrom.\n\nAttila: I have no idea if this even exists on Windows, but aside from\nother suggestions in this thread I'd suggest enabling whatever Window's\nequivalent of \"sync\" mounting is (if it even exists). I.e. to have every\nsingle FS operation by synced to the metal. \n\nIt will make your repository *much much slower*, but it will be safe as\nfar as any logic errors in git vis-a-vis syncing go.\n"},{"id":"454263","messageId":"CAMYm8FqU8zHUPFqWdM3Mpw3kj4yHEqHsNYFXz+b+p0vZZaVjYw@mail.gmail.com","threadId":"57749","inReplyTo":"220422.868rrx5uju.gmgdl@evledraar.gmail.com","subject":"Re: Git bug report - disk errors on Windows after push","fromName":"Attila Csosz","fromEmail":"csosza@designsoftware.com","sentAt":"2022-04-22T15:04:32Z","receivedAt":"2022-04-22T15:04:54Z","isPatch":false,"sender":{"key":"csosza@designsoftware.com","avatar":null},"body":"I'm using git on Windows for 6-7 years sometimes facing this problem\n(different computers, different HDDs). Last time the problem occured\non my internal laptop HDD. So I have decided to report the problem.\n\nIf unstable to use local bare repos on Windows you should mention in\nsomewhere or completly disable it. Disk errors are unacceptable even\nthe git repo is corrupted.\n\nPlease check this link also\nhttps://github.community/t/what-could-be-the-reason-my-git-repositories-keep-getting-corrupted-broken/184711\n\nAttila\n\n\nOn Fri, Apr 22, 2022 at 11:27 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n>\n> On Mon, Apr 18 2022, brian m. carlson wrote:\n>\n> > [[PGP Signed Part:Undecided]]\n> > Hey,\n> >\n> > On 2022-04-18 at 07:47:07, Attila Csosz wrote:\n> >> Thank you for filling out a Git bug report!\n> >> Please answer the following questions to help us understand your issue.\n> >>\n> >> What did you do before the bug happened? (Steps to reproduce your issue)\n> >> Pushing to a directory directly.\n> >>\n> >> What did you expect to happen? (Expected behavior)\n> >> Good behavior\n> >>\n> >> What happened instead? (Actual behavior)\n> >> Disk errors. After pushing to a directory (my origin field is C:\\Work for\n> >> example) the git repository will be corrupted.\n> >> Moreover causing disk errors not only in the target git bare repository.\n> >> I've loosed some other files.\n> >> Cannot be reproduced exactly. However I have decided to report this problem.\n> >> I've experienced this problem for several years.\n> >\n> > There's nothing that Git should be able to do as a normal operating\n> > system that causes disk errors.  If you're seeing those kinds of errors,\n> > the likelihood is that your disk is bad and you need to replace it.\n> >\n> > Do note that if you're storing your data in a directory managed by a\n> > cloud syncing service (e.g., Dropbox or OneDrive), then it is known that\n> > those file systems corrupt Git repositories and you shouldn't use them\n> > with Git.  That's due to the way they sync data.\n> >\n> > However, if this is a regular file system (e.g., NTFS), then Git\n> > shouldn't be able to cause disk problems, and if it could, that would be\n> > a serious defect in Windows, so it's almost certainly going to be a\n> > hardware problem.\n>\n> I think you're most likely right that this is some local HW issue, but\n> the report doesn't have enough information to say either way.\n>\n> But generally as we've been discussing at length in various threads\n> related to git's fsync() behavior we can and will corrupt repositories\n> due only to our own (mis)use of FS APIs, i.e. not doing fsyncing and the\n> like correctly, it's been improved a bit recently.\n>\n> But we're still in a state of not doing it correctly, and/or relying on\n> some implicit assumptions.\n>\n> For something like an external disk that may have its power cable yanked\n> I'd give it about even odds that it's HW v.s. git's own FS syncing logic\n> being at fault.\n>\n> We get away with a lot of shenanigans because we're usually on a\n> journaled FS, which e.g. on a FAT32 external volume we won't benefit\n> from.\n>\n> Attila: I have no idea if this even exists on Windows, but aside from\n> other suggestions in this thread I'd suggest enabling whatever Window's\n> equivalent of \"sync\" mounting is (if it even exists). I.e. to have every\n> single FS operation by synced to the metal.\n>\n> It will make your repository *much much slower*, but it will be safe as\n> far as any logic errors in git vis-a-vis syncing go.\n"},{"id":"454265","messageId":"xmqq1qxpcd08.fsf@gitster.g","threadId":"57749","inReplyTo":"220422.868rrx5uju.gmgdl@evledraar.gmail.com","subject":"Re: Git bug report - disk errors on Windows after push","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-22T16:13:27Z","receivedAt":"2022-04-22T16:13:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> For something like an external disk that may have its power cable yanked\n> I'd give it about even odds that it's HW v.s. git's own FS syncing logic\n> being at fault.\n\nGiven that the original report had this:\n\n    Disk errors. After pushing to a directory (my origin field is C:\\Work\n    for example) the git repository will be corrupted.\n    Moreover causing disk errors not only in the target git bare\n    repository. I've loosed some other files.\n\nthat clearly stated that the corruption spreads outside repositories\nmanaged (and written and fsynced) by Git, it does not seem likely\nthat Git's relying on \"closing is enough as sync daemon will\neventually flush them\" is the primary source of corruption.\n\nThe recent \"are we fsyncing correctly?\" topic is about how likely we\nwould survive in the presense of actions like unplugging without\nunmounting.  It does not help a bit against flaky hardware, and even\nwhen it helps, it is merely making the damage caused by such actions\nless severe.\n"}]}