verify_path: disallow symlinks in .gitmodules

There are a few reasons it's not a good idea to make
.gitmodules a symlink, including:

  1. It won't be portable to systems without symlinks.

  2. It may behave inconsistently, since Git may look at
     this file in the index or a tree without bothering to
     resolve any symbolic links. We don't do this _yet_, but
     the config infrastructure is there and it's planned for
     the future.

With some clever code, we could make (2) work. And some
people may not care about (1) if they only work on one
platform. But there are a few security reasons to simply
disallow it:

  a. A symlinked .gitmodules file may circumvent any fsck
     checks of the content.

  b. Git may read and write from the on-disk file without
     sanity checking the symlink target. So for example, if
     you link ".gitmodules" to "../oops" and run "git
     submodule add", we'll write to the file "oops" outside
     the repository.

Again, both of those are problems that _could_ be solved
with sufficient code, but given the complications in (1) and
(2), we're better off just outlawing it explicitly.

Note the slightly tricky call to verify_path() in
update-index's update_one(). There we may not have a mode if
we're not updating from the filesystem (e.g., we might just
be removing the file). Passing "0" as the mode there works
fine; since it's not a symlink, we'll just skip the extra
checks.

Signed-off-by: Jeff King <peff@peff.net>
4 files changed
tree: 47fd3ecfa1590f62eaa65dced6aef152a85b33e6
  1. .github/
  2. block-sha1/
  3. builtin/
  4. ci/
  5. compat/
  6. contrib/
  7. Documentation/
  8. ewah/
  9. git-gui/
  10. gitk-git/
  11. gitweb/
  12. mergetools/
  13. perl/
  14. po/
  15. ppc/
  16. refs/
  17. sha1dc/
  18. t/
  19. templates/
  20. vcs-svn/
  21. xdiff/
  22. .gitattributes
  23. .gitignore
  24. .mailmap
  25. .travis.yml
  26. abspath.c
  27. aclocal.m4
  28. advice.c
  29. advice.h
  30. alias.c
  31. alloc.c
  32. apply.c
  33. apply.h
  34. archive-tar.c
  35. archive-zip.c
  36. archive.c
  37. archive.h
  38. argv-array.c
  39. argv-array.h
  40. attr.c
  41. attr.h
  42. base85.c
  43. bisect.c
  44. bisect.h
  45. blob.c
  46. blob.h
  47. branch.c
  48. branch.h
  49. builtin.h
  50. bulk-checkin.c
  51. bulk-checkin.h
  52. bundle.c
  53. bundle.h
  54. cache-tree.c
  55. cache-tree.h
  56. cache.h
  57. check-builtins.sh
  58. check-racy.c
  59. check_bindir
  60. color.c
  61. color.h
  62. column.c
  63. column.h
  64. combine-diff.c
  65. command-list.txt
  66. commit-slab.h
  67. commit.c
  68. commit.h
  69. common-main.c
  70. config.c
  71. config.mak.in
  72. config.mak.uname
  73. configure.ac
  74. connect.c
  75. connect.h
  76. connected.c
  77. connected.h
  78. convert.c
  79. convert.h
  80. copy.c
  81. COPYING
  82. credential-cache--daemon.c
  83. credential-cache.c
  84. credential-store.c
  85. credential.c
  86. credential.h
  87. csum-file.c
  88. csum-file.h
  89. ctype.c
  90. daemon.c
  91. date.c
  92. decorate.c
  93. decorate.h
  94. delta.h
  95. diff-delta.c
  96. diff-lib.c
  97. diff-no-index.c
  98. diff.c
  99. diff.h
  100. diffcore-break.c
  101. diffcore-delta.c
  102. diffcore-order.c
  103. diffcore-pickaxe.c
  104. diffcore-rename.c
  105. diffcore.h
  106. dir-iterator.c
  107. dir-iterator.h
  108. dir.c
  109. dir.h
  110. editor.c
  111. entry.c
  112. environment.c
  113. exec_cmd.c
  114. exec_cmd.h
  115. fast-import.c
  116. fetch-pack.c
  117. fetch-pack.h
  118. fmt-merge-msg.h
  119. fsck.c
  120. fsck.h
  121. generate-cmdlist.sh
  122. gettext.c
  123. gettext.h
  124. git-add--interactive.perl
  125. git-archimport.perl
  126. git-bisect.sh
  127. git-compat-util.h
  128. git-cvsexportcommit.perl
  129. git-cvsimport.perl
  130. git-cvsserver.perl
  131. git-difftool--helper.sh
  132. git-filter-branch.sh
  133. git-instaweb.sh
  134. git-merge-octopus.sh
  135. git-merge-one-file.sh
  136. git-merge-resolve.sh
  137. git-mergetool--lib.sh
  138. git-mergetool.sh
  139. git-p4.py
  140. git-parse-remote.sh
  141. git-quiltimport.sh
  142. git-rebase--am.sh
  143. git-rebase--interactive.sh
  144. git-rebase--merge.sh
  145. git-rebase.sh
  146. git-remote-testgit.sh
  147. git-request-pull.sh
  148. git-send-email.perl
  149. git-sh-i18n.sh
  150. git-sh-setup.sh
  151. git-stash.sh
  152. git-submodule.sh
  153. git-svn.perl
  154. GIT-VERSION-GEN
  155. git-web--browse.sh
  156. git.c
  157. git.rc
  158. gpg-interface.c
  159. gpg-interface.h
  160. graph.c
  161. graph.h
  162. grep.c
  163. grep.h
  164. hash.h
  165. hashmap.c
  166. hashmap.h
  167. help.c
  168. help.h
  169. hex.c
  170. http-backend.c
  171. http-fetch.c
  172. http-push.c
  173. http-walker.c
  174. http.c
  175. http.h
  176. ident.c
  177. imap-send.c
  178. INSTALL
  179. iterator.h
  180. khash.h
  181. kwset.c
  182. kwset.h
  183. levenshtein.c
  184. levenshtein.h
  185. LGPL-2.1
  186. line-log.c
  187. line-log.h
  188. line-range.c
  189. line-range.h
  190. list-objects.c
  191. list-objects.h
  192. list.h
  193. ll-merge.c
  194. ll-merge.h
  195. lockfile.c
  196. lockfile.h
  197. log-tree.c
  198. log-tree.h
  199. mailinfo.c
  200. mailinfo.h
  201. mailmap.c
  202. mailmap.h
  203. Makefile
  204. match-trees.c
  205. merge-blobs.c
  206. merge-blobs.h
  207. merge-recursive.c
  208. merge-recursive.h
  209. merge.c
  210. mergesort.c
  211. mergesort.h
  212. mru.c
  213. mru.h
  214. name-hash.c
  215. notes-cache.c
  216. notes-cache.h
  217. notes-merge.c
  218. notes-merge.h
  219. notes-utils.c
  220. notes-utils.h
  221. notes.c
  222. notes.h
  223. object.c
  224. object.h
  225. oidset.c
  226. oidset.h
  227. pack-bitmap-write.c
  228. pack-bitmap.c
  229. pack-bitmap.h
  230. pack-check.c
  231. pack-objects.c
  232. pack-objects.h
  233. pack-revindex.c
  234. pack-revindex.h
  235. pack-write.c
  236. pack.h
  237. pager.c
  238. parse-options-cb.c
  239. parse-options.c
  240. parse-options.h
  241. patch-delta.c
  242. patch-ids.c
  243. patch-ids.h
  244. path.c
  245. pathspec.c
  246. pathspec.h
  247. pkt-line.c
  248. pkt-line.h
  249. preload-index.c
  250. pretty.c
  251. prio-queue.c
  252. prio-queue.h
  253. progress.c
  254. progress.h
  255. prompt.c
  256. prompt.h
  257. quote.c
  258. quote.h
  259. reachable.c
  260. reachable.h
  261. read-cache.c
  262. README.md
  263. ref-filter.c
  264. ref-filter.h
  265. reflog-walk.c
  266. reflog-walk.h
  267. refs.c
  268. refs.h
  269. remote-curl.c
  270. remote-testsvn.c
  271. remote.c
  272. remote.h
  273. replace_object.c
  274. rerere.c
  275. rerere.h
  276. resolve-undo.c
  277. resolve-undo.h
  278. revision.c
  279. revision.h
  280. run-command.c
  281. run-command.h
  282. send-pack.c
  283. send-pack.h
  284. sequencer.c
  285. sequencer.h
  286. server-info.c
  287. setup.c
  288. sh-i18n--envsubst.c
  289. sha1-array.c
  290. sha1-array.h
  291. sha1-lookup.c
  292. sha1-lookup.h
  293. sha1_file.c
  294. sha1_name.c
  295. sha1dc_git.c
  296. sha1dc_git.h
  297. shallow.c
  298. shell.c
  299. shortlog.h
  300. show-index.c
  301. sideband.c
  302. sideband.h
  303. sigchain.c
  304. sigchain.h
  305. split-index.c
  306. split-index.h
  307. strbuf.c
  308. strbuf.h
  309. streaming.c
  310. streaming.h
  311. string-list.c
  312. string-list.h
  313. submodule-config.c
  314. submodule-config.h
  315. submodule.c
  316. submodule.h
  317. symlinks.c
  318. tag.c
  319. tag.h
  320. tar.h
  321. tempfile.c
  322. tempfile.h
  323. thread-utils.c
  324. thread-utils.h
  325. tmp-objdir.c
  326. tmp-objdir.h
  327. trace.c
  328. trace.h
  329. trailer.c
  330. trailer.h
  331. transport-helper.c
  332. transport.c
  333. transport.h
  334. tree-diff.c
  335. tree-walk.c
  336. tree-walk.h
  337. tree.c
  338. tree.h
  339. unicode_width.h
  340. unimplemented.sh
  341. unix-socket.c
  342. unix-socket.h
  343. unpack-trees.c
  344. unpack-trees.h
  345. upload-pack.c
  346. url.c
  347. url.h
  348. urlmatch.c
  349. urlmatch.h
  350. usage.c
  351. userdiff.c
  352. userdiff.h
  353. utf8.c
  354. utf8.h
  355. varint.c
  356. varint.h
  357. version.c
  358. version.h
  359. versioncmp.c
  360. walker.c
  361. walker.h
  362. wildmatch.c
  363. wildmatch.h
  364. worktree.c
  365. worktree.h
  366. wrap-for-bin.sh
  367. wrapper.c
  368. write_or_die.c
  369. ws.c
  370. wt-status.c
  371. wt-status.h
  372. xdiff-interface.c
  373. xdiff-interface.h
  374. zlib.c
README.md

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.txt to get started, then see Documentation/giteveryday.txt for a useful minimum set of commands, and Documentation/git-.txt for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.txt (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission). To subscribe to the list, send an email with just “subscribe git” in the body to majordomo@vger.kernel.org. The mailing list archives are available at https://public-inbox.org/git/, http://marc.info/?l=git and other archival sites.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks