CINXE.COM

LKML: Linus Torvalds: Re: Kernel SCM saga..

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>LKML: Linus Torvalds: Re: Kernel SCM saga..</title><link href="/css/message.css" rel="stylesheet" type="text/css" /><link href="/css/wrap.css" rel="alternate stylesheet" type="text/css" title="wrap" /><link href="/css/nowrap.css" rel="stylesheet" type="text/css" title="nowrap" /><link href="/favicon.ico" rel="shortcut icon" /><script src="/js/simple-calendar.js" type="text/javascript"></script><script src="/js/styleswitcher.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="lkml.org : last 100 messages" href="/rss.php" /><link rel="alternate" type="application/rss+xml" title="lkml.org : last messages by Linus Torvalds" href="/groupie.php?aid=1" /><!--Matomo--><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//m.lkml.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!--End Matomo Code--></head><body onload="es.jasper.simpleCalendar.init();" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"><table border="0" cellpadding="0" cellspacing="0"><tr><td width="180" align="center"><a href="/"><img style="border:0;width:135px;height:32px" src="/images/toprowlk.gif" alt="lkml.org" /></a></td><td width="32">聽</td><td class="nb"><div><a class="nb" href="/lkml"> [lkml]</a> 聽 <a class="nb" href="/lkml/2005"> [2005]</a> 聽 <a class="nb" href="/lkml/2005/4"> [Apr]</a> 聽 <a class="nb" href="/lkml/2005/4/9"> [9]</a> 聽 <a class="nb" href="/lkml/last100"> [last100]</a> 聽 <a href="/rss.php"><img src="/images/rss-or.gif" border="0" alt="RSS Feed" /></a></div><div>Views: <a href="#" class="nowrap" onclick="setActiveStyleSheet('wrap');return false;">[wrap]</a><a href="#" class="wrap" onclick="setActiveStyleSheet('nowrap');return false;">[no wrap]</a> 聽 <a class="nb" href="/lkml/mheaders/2005/4/9/74" onclick="this.href='/lkml/headers'+'/2005/4/9/74';">[headers]</a>聽 <a href="/lkml/bounce/2005/4/9/74">[forward]</a>聽 </div></td><td width="32">聽</td></tr><tr><td valign="top"><div class="es-jasper-simpleCalendar" baseurl="/lkml/"></div><div class="threadlist">Messages in this thread</div><ul class="threadlist"><li class="root"><a href="/lkml/2005/4/6/121">First message in thread</a></li><li><a href="/lkml/2005/4/8/172">Linus Torvalds</a><ul><li><a href="/lkml/2005/4/8/341">Petr Baudis</a><ul><li><a href="/lkml/2005/4/9/19">"Randy.Dunlap"</a><ul><li><a href="/lkml/2005/4/9/95">Petr Baudis</a></li></ul></li><li><a href="/lkml/2005/4/9/144">Phillip Lougher</a><ul><li><a href="/lkml/2005/4/9/147">Petr Baudis</a><ul><li><a href="/lkml/2005/4/9/148">Phillip Lougher</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2005/4/9/70">Paul Jackson</a><ul><li class="origin"><a href="/lkml/2005/4/9/80">Linus Torvalds</a><ul><li><a href="/lkml/2005/4/9/80">Paul Jackson</a></li><li><a href="/lkml/2005/4/9/162">Paul Jackson</a></li><li><a href="/lkml/2005/4/10/12">David Lang</a><ul><li><a href="/lkml/2005/4/10/20">Junio C Hamano</a></li></ul></li></ul></li></ul></li></ul></li></ul></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerl.gif" width="32" height="32" alt="/" /></td><td class="c" rowspan="2" valign="top" style="padding-top: 1em"><table><tr><td><table><tr><td class="lp">Date</td><td class="rp" itemprop="datePublished">Sat, 9 Apr 2005 09:26:07 -0700 (PDT)</td></tr><tr><td class="lp">From</td><td class="rp" itemprop="author">Linus Torvalds &lt;&gt;</td></tr><tr><td class="lp">Subject</td><td class="rp" itemprop="name">Re: Kernel SCM saga..</td></tr></table></td><td></td></tr></table><pre itemprop="articleBody"><br /><br />On Sat, 9 Apr 2005, Paul Jackson wrote:<br />&gt;<br />&gt; &gt; in order to avoid having to worry about special characters<br />&gt; &gt; they are NUL-terminated)<br />&gt; <br />&gt; Would this be a possible alternative - newline terminated (convert any<br />&gt; newlines embedded in filenames to the 3 chars '%0A', and leave it as an<br />&gt; exercise to the reader to de-convert them.)<br /><br />Sure, you could obviously do escaping (you need to remember to escape '%' <br />too when you do that ;).<br /><br />However, whenever you do escaping, that means that you're already going to <br />have to use a tool to unpack the dang thing. So you didn't actually win <br />anything. I pretty much guarantee that my existing format is easier to <br />unpack than your escaped format.<br /><br />ASCII isn't magical.<br /><br />This is "fsck_tree()", which walks the unpacked tree representation and <br />checks that it looks sane and marks the sha1's it finds as being <br />needed (so that you can do reachability analysis in a second pass). It's <br />not exactly complicated:<br /><br /> static int fsck_tree(unsigned char *sha1, void *data, unsigned long size)<br /> {<br /> while (size) {<br /> int len = 1+strlen(data);<br /> unsigned char *file_sha1 = data + len;<br /> char *path = strchr(data, ' ');<br /> if (size &lt; len + 20 || !path)<br /> return -1;<br /> data += len + 20;<br /> size -= len + 20;<br /> mark_needs_sha1(sha1, "blob", file_sha1);<br /> }<br /> return 0;<br /> }<br /><br />and there's one HUGE advantage to _not_ having escaping: sorting and<br />comparing.<br /><br />If you escape things, you now have to decide how you sort filenames. Do<br />you sort them by the escaped representation, or by the "raw" <br />representation? Do you always have to escape or unescape the name in order <br />to sort it.<br /><br />So I like ASCII as much as the next guy, but it's not a religion. If there <br />isn't any point to it, there isn't any point to it.<br /><br />The biggest irritation I have with the "tree" format I chose is actually<br />not the name (which is trivial), it's the &lt;sha1&gt; part. Almost everything<br />else keeps the &lt;sha1&gt; in the ASCII hexadecimal representation, and I<br />should have done that here too. Why? Not because it's a &lt;sha1&gt; - hey, the <br />binary representation is certainly denser and equivalent - but because an <br />ASCII representation there would have allowed me to much more easily <br />change the key format if I ever wanted to. Now it's very SHA1-specific.<br /><br />Which I guess is fine - I don't really see any reason to change, and if I <br />do change, I could always just re-generate the whole tree. But I think it <br />would have been cleaner to have _that_ part in ASCII.<br /><br /> Linus<br />-<br />To unsubscribe from this list: send the line "unsubscribe linux-kernel" in<br />the body of a message to majordomo&#64;vger.kernel.org<br />More majordomo info at <a href="http://vger.kernel.org/majordomo-info.html">http://vger.kernel.org/majordomo-info.html</a><br />Please read the FAQ at <a href="http://www.tux.org/lkml/">http://www.tux.org/lkml/</a><br /><br /></pre></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerr.gif" width="32" height="32" alt="\" /></td></tr><tr><td align="right" valign="bottom"> 聽 </td></tr><tr><td align="right" valign="bottom">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerl.gif" width="32" height="32" alt="\" /></td><td class="c">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerr.gif" width="32" height="32" alt="/" /></td></tr><tr><td align="right" valign="top" colspan="2"> 聽 </td><td class="lm">Last update: 2009-11-18 23:46 聽聽 [from the cache]<br />漏2003-2020 <a href="http://blog.jasper.es/"><span itemprop="editor">Jasper Spaans</span></a>|hosted at <a href="https://www.digitalocean.com/?refcode=9a8e99d24cf9">Digital Ocean</a> and my Meterkast|<a href="http://blog.jasper.es/categories.html#lkml-ref">Read the blog</a></td><td>聽</td></tr></table><script language="javascript" src="/js/styleswitcher.js" type="text/javascript"></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10