{"thread":{"id":"54616","subject":"format-patch: \"magic\" mbox timestamp","startedAt":"2020-11-10T21:55:16Z","lastAt":"2020-11-10T23:23:02Z","messageCount":4,"participants":["Brandon Richardson","Johannes Schindelin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"409556","messageId":"CAETBDP6d8UwiJEF_pX0p=xLG79pwHeEtectmOnjPiUpjUCPaqw@mail.gmail.com","threadId":"54616","inReplyTo":null,"subject":"format-patch: \"magic\" mbox timestamp","fromName":"Brandon Richardson","fromEmail":"brandon1024.br@gmail.com","sentAt":"2020-11-10T21:54:47Z","receivedAt":"2020-11-10T21:55:16Z","isPatch":false,"sender":{"key":"brandon1024.br@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22732449?v=4"},"body":"Hi all,\n\nAfter submitting a patch internally within our organization today, I\nwas looking through the `format-patch` output and was curious to see\nthe strange timestamp on the \"From\" line. At first glance I thought\nthe parent commit timestamp might have been off, but that wasn't the\ncase. I thought it might be a bug but quickly noticed the fixed\ntimestamp string in `log-tree`.\n\nReading through the various revisions of `log-tree.c` didn't answer\nmany questions either, until I turned to the docs and read:\n\n> The patch produced by git format-patch is in UNIX mailbox format, with a fixed \"magic\" time stamp to indicate that the file is output from format-patch rather than a real mailbox [...]\n\nI find this pretty interesting, and would like to hear more from those\nthat introduced change. It looks like this was first introduced in\n3eefc18917 (Tentative built-in format-patch., 2006-04-18), albeit with\na different \"magic\" timestamp, and then changed to its current\ntimestamp value in 698ce6f87e (fmt-patch: Support --attach,\n2006-05-20).\n\nPlease correct me if I'm wrong, but I'm assuming the \"UNIX mailbox\nformat\" referenced in the docs refers to the mbox database format\ndescribed in appendix A of RFC-4155. If so, since we use a commit id\nin place of the sender email address, would that itself be sufficient\nto indicate that the output isn't from a real mailbox? A commit id\nwill never match the addr-spec in RFC-2822, so I figure that anyone\nlooking at `format-patch` output could safely assume that it did not\noriginate from a mailbox.\n\nI could see this as a good opportunity to use a more relevant\ntimestamp, perhaps the commit timestamp of the first patch in the\nseries.\n"},{"id":"409564","messageId":"nycvar.QRO.7.76.6.2011102347320.18437@tvgsbejvaqbjf.bet","threadId":"54616","inReplyTo":"CAETBDP6d8UwiJEF_pX0p=xLG79pwHeEtectmOnjPiUpjUCPaqw@mail.gmail.com","subject":"Re: format-patch: \"magic\" mbox timestamp","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2020-11-10T23:12:05Z","receivedAt":"2020-11-10T23:12:15Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Brandon,\n\nOn Tue, 10 Nov 2020, Brandon Richardson wrote:\n\n> After submitting a patch internally within our organization today, I\n> was looking through the `format-patch` output and was curious to see\n> the strange timestamp on the \"From\" line. At first glance I thought\n> the parent commit timestamp might have been off, but that wasn't the\n> case. I thought it might be a bug but quickly noticed the fixed\n> timestamp string in `log-tree`.\n>\n> Reading through the various revisions of `log-tree.c` didn't answer\n> many questions either, until I turned to the docs and read:\n>\n> > The patch produced by git format-patch is in UNIX mailbox format, with a fixed \"magic\" time stamp to indicate that the file is output from format-patch rather than a real mailbox [...]\n>\n> I find this pretty interesting, and would like to hear more from those\n> that introduced change. It looks like this was first introduced in\n> 3eefc18917 (Tentative built-in format-patch., 2006-04-18), albeit with\n> a different \"magic\" timestamp, and then changed to its current\n> timestamp value in 698ce6f87e (fmt-patch: Support --attach,\n> 2006-05-20).\n>\n> Please correct me if I'm wrong, but I'm assuming the \"UNIX mailbox\n> format\" referenced in the docs refers to the mbox database format\n> described in appendix A of RFC-4155. If so, since we use a commit id\n> in place of the sender email address, would that itself be sufficient\n> to indicate that the output isn't from a real mailbox? A commit id\n> will never match the addr-spec in RFC-2822, so I figure that anyone\n> looking at `format-patch` output could safely assume that it did not\n> originate from a mailbox.\n>\n> I could see this as a good opportunity to use a more relevant\n> timestamp, perhaps the commit timestamp of the first patch in the\n> series.\n\nAn interesting hike down memory lane. As to the explanation for the latter\nchange (\"fmt-patch: Support --attach\"), here is your answer:\nhttps://lore.kernel.org/git/Pine.LNX.4.63.0605201904320.31887@wbgn013.biozentrum.uni-wuerzburg.de/\n\n\tOn Sat, 20 May 2006, Jakub Narebski wrote:\n\n\t> Johannes Schindelin wrote:\n\t>\n\t> > -             printf(\"From %s  Thu Apr 7 15:13:13 2005\\n\",\n\t> > -                    sha1_to_hex(commit->object.sha1));\n\t> > +             printf(\"From %s Mon Sep 17 00:00:00 2001\\n\", sha1);\n\t>\n\t> What's with the date?\n\n\tDoes not matter. This is not part of the mail header (the date is\n\tdisplayed as a \"Date:\" line).\n\n\tI only changed the \"From \" line (note the missing \":\") to match the output\n\tfrom git-format-patch.sh.\n\nAs to \"Tentative built-in format-patch\", I can only _guess_ that the\ntimestamp was chosen to be identical to the first ever Git commit's\ntimestamp: e83c5163316 (Initial revision of \"git\", the information manager\nfrom hell, 2005-04-07).\n\nThe original magic timestamp, however, was the one I reintroduced, and as\nyou can see from the part I quoted above, I only imitated the original\nscript. I do remember, even if it has been a lifetime ago, that I wondered\nwhat kind of special date September 17th could have been for Junio, but I\nfelt it might have been too personal a question. That timestamp was\nintroduced into Git's source code in 5c2c972f474 ([PATCH] format-patch:\n--mbox and --check., 2005-07-22), but the commit message is also quite mum\nabout the motivation between that particular timestamp.\n\nCiao,\nJohannes\n"},{"id":"409565","messageId":"xmqqmtzo6c0d.fsf@gitster.c.googlers.com","threadId":"54616","inReplyTo":"CAETBDP6d8UwiJEF_pX0p=xLG79pwHeEtectmOnjPiUpjUCPaqw@mail.gmail.com","subject":"Re: format-patch: \"magic\" mbox timestamp","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-11-10T23:13:54Z","receivedAt":"2020-11-10T23:14:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brandon Richardson <brandon1024.br@gmail.com> writes:\n\n> Please correct me if I'm wrong, but I'm assuming the \"UNIX mailbox\n> format\" referenced in the docs refers to the mbox database format\n> described in appendix A of RFC-4155. If so, since we use a commit id\n> in place of the sender email address, would that itself be sufficient\n> to indicate that the output isn't from a real mailbox? A commit id\n> will never match the addr-spec in RFC-2822, so I figure that anyone\n> looking at `format-patch` output could safely assume that it did not\n> originate from a mailbox.\n\nI vaguely recall that it was possible for the \"From\" line that\nbegins each message in a UNIX mbox had a local sender without \"@\",\nso it would be a bit wider than addr-spec and a string of raw\nhexadecimal digits would not sufficiently \"strange\" enough to serve\nas a \"magic\" identifier.\n\n"},{"id":"409566","messageId":"xmqqimac6bld.fsf@gitster.c.googlers.com","threadId":"54616","inReplyTo":"nycvar.QRO.7.76.6.2011102347320.18437@tvgsbejvaqbjf.bet","subject":"Re: format-patch: \"magic\" mbox timestamp","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-11-10T23:22:54Z","receivedAt":"2020-11-10T23:23:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> The original magic timestamp, however, was the one I reintroduced, and as\n> you can see from the part I quoted above, I only imitated the original\n> script.\n\nThat's almost a lifetime ago that I totally forgot that it was\noriginal a shell script.  \n\nIt indeed does this:\n\n+\tcase \"$mbox\" in\n+\tt)\n+\t    echo 'From nobody Mon Sep 17 00:00:00 2001' ;# UNIX \"From\" line\n+\t    mailScript=\"$mailScript\"'\n+\t    s|^|Subject: [PATCH'\"$num\"'] |'\n+\t    ;;\n\nwhich clearly shows that \"nobody\" was chosen to mimic a real mailbox\n(i.e. unlike what Brandon said in the other message, the <mailbox>\nmay not have \"@\" <domain> after <local-part>).\n\nIn any case, I think what's more important is after 15 years, if any\nimplementation of the /etc/magic database actually take advantage of\nthat magic date as the \"magic\" signal to identify a format-patch\noutput.  Despite the wishes of original authors and designers of Git\nand its format-patch output, perhaps no /etc/magic author noticed it,\nin which case it is safe to use other randomly picked dates, or the\ntimestamp of underlying commits.  Otherwise, changing the \"magic\"\ntimestamp would introduce a needless regression.\n\n"}]}