All of lore.kernel.org
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Rowan Thorpe <rowan@rowanthorpe.com>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>, git@vger.kernel.org
Subject: "git fast-import" crashes parsing output from "fossil export --git"
Date: Mon, 29 Jan 2018 18:11:27 +0100	[thread overview]
Message-ID: <20180129171127.17097-1-szeder.dev@gmail.com> (raw)
In-Reply-To: <CACgDUr6XG+dZ+GJcf9+11Edf=q-=QLSkmgpGf=XmondaLaescA@mail.gmail.com>

> "git fast-import" fails while trying to import the latest "Fossil"
> fossil-sources (it dog-foods its own source-code). Namely, the below
> pasted commands caused the crash report below them (I've trimmed
> irrelevant noise from the report for brevity). One of the tests
> included in Fossil uses example-files to test its handling of
> filenames with special characters - in this case an embedded newline
> in "abc[NEWLINE]def.txt" - and "git fast-import" causes the second
> part of that filename (post-newline) to spill over as the "command" on
> the next line of its input when transforming the "fossil export"
> output into usable input. Considering git can handle such filenames, I
> guess "git fast-import" not handling them counts as a bug - unless a
> design-decision was made to not be as rigorous for the sake of
> simplicity in the import protocol? Or is "fossil export" perhaps
> outputting the filename incorrectly for the "fast-import" protocol
> (maybe it needs some kind of quoting)?
> 
> * Commands which cause the crash:
> ----8<----
> fossil clone https://www.fossil-scm.org/xfer fossil.fossil
> git init fossil-git
> cd fossil-git
> fossil export --git ../fossil.fossil | git fast-import
> ----8<----
> 
> * The part of "fossil export" output which breaks "git fast-import":
> ----8<----
> ...
> 
> commit refs/heads/test-ticket-d17d6e5b17
> mark :26782
> committer jan.nijtmans <jan.nijtmans> 1353531216 +0000
> data 82
> Just commit some weird filenames, even one with a newline in it, to
> test the code.
> from :26779
> M 100644 :427 :abc
> M 100644 :10049 abc
> def.txt

A path like this must be quoted.  Quoting from 'git fast-import'
manpage:

  A <path> string must use UNIX-style directory separators (forward
  slash /), may contain any byte other than LF, and must not start
  with double quote (").

  A path can use C-style string quoting; this is accepted in all
  cases and mandatory if the filename starts with double quote or
  contains LF. In C-style quoting, the complete name should be
  surrounded with double quotes, and any LF, backslash, or double
  quote characters must be escaped by preceding them with a backslash
  (e.g., "path/with\n, \\ and \" in it").
 

  reply	other threads:[~2018-01-29 17:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29 16:47 "git fast-import" crashes parsing output from "fossil export --git" Rowan Thorpe
2018-01-29 17:11 ` SZEDER Gábor [this message]
2018-01-29 20:15   ` Rowan Thorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180129171127.17097-1-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rowan@rowanthorpe.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.