git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG] Git add <device file> silently fails

From
AGAndreas Gruenbacher <agruen@suse.de>
Date
Apr 17, 2010, 14:24 UTC
Message-ID
<201004171624.17797.agruen@suse.de>
Hello,

there is code in read-cache.c:add_to_index() which checks if a file to be added is a regular file, directory, or symlink; this function otherwise error()s out. It looks as if add_to_index() is supposed to be called via:

  builtin/add.c:update_callback() ->
    read-cache.c:add_file_to_index() ->
      read-cache.c:add_to_index()

However, when trying to add a device special file, update_callback() ends up never getting called, no error message is produced, and git add silently fails:

	$ sudo mknod foobar c 1 3
	$ git add foobar
   $ echo $?
	0
Maybe someone familiar with run_diff_files() can have a look?

Thanks, Andreas

Next: Alex Riesen
Message 1 of 9 in “[BUG] Git add <device file> silently fails”
  1. Andreas GruenbacherApr 17, 2010
  2. Alex RiesenApr 17, 2010
  3. Andreas GruenbacherApr 17, 2010
  4. Alex RiesenApr 17, 2010
  5. Junio C HamanoApr 17, 2010
  6. Alex RiesenApr 17, 2010
  7. Alex RiesenApr 17, 2010
  8. Andreas GruenbacherApr 17, 2010
  9. Junio C HamanoApr 19, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.