Debian Bug report logs - #696178
git: Non-helpful error message if expected object file is a directory: fatal: Out of memory? mmap failed: No such device

version graph

Package: git; Maintainer for git is Jonathan Nieder <[email protected]>; Source for git is src:git (PTS, buildd, popcon).

Reported by: Axel Beckert <[email protected]>

Date: Mon, 17 Dec 2012 16:15:07 UTC

Severity: minor

Found in version git/1:1.7.10.4-2

Reply or subscribe to this bug.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to [email protected], Gerrit Pape <[email protected]>:
Bug#696178; Package git. (Mon, 17 Dec 2012 16:15:09 GMT) (full text, mbox, link).


Acknowledgement sent to Axel Beckert <[email protected]>:
New Bug report received and forwarded. Copy sent to [email protected], Gerrit Pape <[email protected]>. (Mon, 17 Dec 2012 16:15:09 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: Axel Beckert <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: git: Non-helpful error message if expected object file is a directory: fatal: Out of memory? mmap failed: No such device
Date: Mon, 17 Dec 2012 17:13:54 +0100 (CET)
Package: git
Version: 1:1.7.10.4-2
Severity: minor

Dear Git Maintainer,

the following case likely was initially caused through some underlying
file system corruption. Nevertheless git's error message is anything but
helpful here:

/tmp # mkdir git-debug
/tmp # cd git-debug
/tmp/git-debug # git init
Initialized empty Git repository in /tmp/git-debug/.git/
/tmp/git-debug # echo foo > bar
/tmp/git-debug # git add bar
/tmp/git-debug # git commit -m bar
[master (root-commit) f2baaf1] bar
 1 file changed, 1 insertion(+)
 create mode 100644 bar
/tmp/git-debug # mkdir -pv .git/objects/5e/ebe399b43531af39cbc484571a6f909991f5c8
mkdir: created directory `.git/objects/5e'
mkdir: created directory `.git/objects/5e/ebe399b43531af39cbc484571a6f909991f5c8'
/tmp/git-debug # git fsck
Checking object directories: 100% (256/256), done.
fatal: Out of memory? mmap failed: No such device
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

("git gc" gives btw. the same error message if the SHA1 id is actually a
referenced object.)

It took me quite a while to figure out what's actually wrong. It would
be nice if git would give a more helpful error message as it does if an
object is not a valid SHA1 id:

/tmp/git-debug # rmdir -v .git/objects/5e/ebe399b43531af39cbc484571a6f909991f5c8
rmdir: removing directory, `.git/objects/5e/ebe399b43531af39cbc484571a6f909991f5c8'
/tmp/git-debug # touch .git/objects/5e/ebe399b43531af39cbc484571a6f909991f5cz
                                                                            ^
/tmp/git-debug # git fsck
bad sha1 file: .git/objects/5e/ebe399b43531af39cbc484571a6f909991f5cz
Checking object directories: 100% (256/256), done.

An error message like "sha1 file is a directory:
.git/objects/5e/ebe399b43531af39cbc484571a6f909991f5c8" would be much
more helpful.

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (990, 'unstable'), (600, 'testing'), (400, 'stable'), (110, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.5-trunk-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages git depends on:
ii  git-man          1:1.7.10.4-2
ii  libc6            2.13-37
ii  libcurl3-gnutls  7.28.0-3
ii  liberror-perl    0.17-1
ii  libexpat1        2.1.0-1
ii  perl-modules     5.14.2-16
ii  zlib1g           1:1.2.7.dfsg-13

Versions of packages git recommends:
ii  less                         456-1
ii  openssh-client [ssh-client]  1:6.0p1-3
ii  patch                        2.6.1-3
ii  rsync                        3.0.9-4

Versions of packages git suggests:
ii  gettext-base                          0.18.1.1-10
ii  git-arch                              1:1.7.10.4-2
ii  git-cvs                               1:1.7.10.4-2
pn  git-daemon-run | git-daemon-sysvinit  <none>
ii  git-doc                               1:1.7.10.4-2
ii  git-el                                1:1.7.10.4-2
ii  git-email                             1:1.7.10.4-2
ii  git-gui                               1:1.7.10.4-2
ii  git-svn                               1:1.7.10.4-2
ii  gitk                                  1:1.7.10.4-2
pn  gitweb                                <none>

-- no debconf information



Information forwarded to [email protected], Gerrit Pape <[email protected]>:
Bug#696178; Package git. (Mon, 11 Jun 2018 18:03:06 GMT) (full text, mbox, link).


Acknowledgement sent to Michał Mirosław <[email protected]>:
Extra info received and forwarded to list. Copy sent to Gerrit Pape <[email protected]>. (Mon, 11 Jun 2018 18:03:06 GMT) (full text, mbox, link).


Message #10 received at [email protected] (full text, mbox, reply):

From: Michał Mirosław <[email protected]>
To: [email protected]
Subject: git: "mmap: No such device" on broken .git tree
Date: Mon, 11 Jun 2018 19:52:36 +0200
Dear Git Maintainer,

This bug is present in git from testing/backports.

# LANG=C apt policy git
git:
  Installed: 1:2.17.1-1~bpo9+1
  Candidate: 1:2.17.1-1~bpo9+1
  Version table:
 *** 1:2.17.1-1~bpo9+1 500
        500 http://ftp.pl.debian.org/debian stretch-backports/main amd64 Packages
        100 /var/lib/dpkg/status
     1:2.11.0-3+deb9u3 500
        500 http://security.debian.org stretch/updates/main amd64 Packages
        500 http://ftp.pl.debian.org/debian stretch-proposed-updates/main amd64 Packages
     1:2.11.0-3+deb9u2 500
        500 http://ftp.pl.debian.org/debian stretch/main amd64 Packages

A script to reproduce:

-----------------
#!/bin/bash
git init foo
cd foo
touch bar
git add -A
git commit -mtest
for i in .git/objects/*/*; do rm -f $i; mkdir $i; break; done
git fsck
# fatal: mmap failed: No such device
------------

Best Regards,
Michał Mirosław



Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 12:27:13 2025; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.