CINXE.COM
LKML: Geert Uytterhoeven: 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: Geert Uytterhoeven: 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 Geert Uytterhoeven" href="/groupie.php?aid=689" /><!--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/8"> [8]</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/8/82" onclick="this.href='/lkml/headers'+'/2005/4/8/82';">[headers]</a>聽 <a href="/lkml/bounce/2005/4/8/82">[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/9">Linus Torvalds</a><ul><li><a href="/lkml/2005/4/8/14">Chris Wedgwood</a><ul><li><a href="/lkml/2005/4/8/18">(H. Peter Anvin)</a><ul><li><a href="/lkml/2005/4/8/42">Rogan Dawes</a><ul><li><a href="/lkml/2005/4/8/44">Daniel Phillips</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2005/4/8/43"> ross@lug ...</a><ul><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></li><li><a href="/lkml/2005/4/9/144">Phillip Lougher</a></li></ul></li><li><a href="/lkml/2005/4/9/70">Paul Jackson</a><ul><li><a href="/lkml/2005/4/9/74">Linus Torvalds</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2005/4/8/46">Andrea Arcangeli</a><ul><li><a href="/lkml/2005/4/8/113">Matthias Andree</a><ul><li><a href="/lkml/2005/4/8/119">Florian Weimer</a></li></ul></li><li><a href="/lkml/2005/4/8/155">Linus Torvalds</a><ul><li><a href="/lkml/2005/4/8/180">Matthias-Christian Ott</a><ul><li><a href="/lkml/2005/4/8/190">Linus Torvalds</a></li><li><a href="/lkml/2005/4/8/315">Marcin Dalecki</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2005/4/8/48">Marcel Lanz</a><ul><li class="origin"><a href="">Geert Uytterhoeven</a></li></ul></li><li><a href="/lkml/2005/4/8/76">Matt Johnston</a></li><li><a href="/lkml/2005/4/12/54">Kedar Sovani</a><ul><li><a href="/lkml/2005/4/12/83">Catalin Marinas</a></li><li><a href="/lkml/2005/4/13/4">Ricky Beam</a></li></ul></li></ul></li></ul><div class="threadlist">Patch in this message</div><ul class="threadlist"><li><a href="/lkml/diff/2005/4/8/82/1">Get diff 1</a></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">Fri, 8 Apr 2005 11:23:19 +0200 (CEST)</td></tr><tr><td class="lp">From</td><td class="rp" itemprop="author">Geert Uytterhoeven <></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">On Fri, 8 Apr 2005, Marcel Lanz wrote:<br />> git on sarge<br />> <br />> --- git-0.02/Makefile.orig 2005-04-07 23:06:19.000000000 +0200<br />> +++ git-0.02/Makefile 2005-04-08 09:24:28.472672224 +0200<br />> @@ -8,7 +8,7 @@ all: $(PROG)<br />> install: $(PROG)<br />> install $(PROG) $(HOME)/bin/<br />> <br />> -LIBS= -lssl<br />> +LIBS= -lssl -lz<br />> <br />> init-db: init-db.o<br />> <br /><br />I found a few more `issues' after adding `-O3 -Wall'.<br />Most are cosmetic, but the missing return value in remove_file_from_cache() is<br />a real bug. Hmm, upon closer look the caller uses its return value in a weird<br />way, so another bug may be hiding in add_file_to_cache().<br /><br />Caveat: everything is untested, besides compilation ;-)<br /><br />diff -purN git-0.02.orig/Makefile git-0.02/Makefile<br />--- git-0.02.orig/Makefile 2005-04-07 23:06:19.000000000 +0200<br />+++ git-0.02/Makefile 2005-04-08 11:02:02.000000000 +0200<br />@@ -1,4 +1,4 @@<br />-CFLAGS=-g<br />+CFLAGS=-g -O3 -Wall<br /> CC=gcc<br /> <br /> PROG=update-cache show-diff init-db write-tree read-tree commit-tree cat-file<br />@@ -8,7 +8,7 @@ all: $(PROG)<br /> install: $(PROG)<br /> install $(PROG) $(HOME)/bin/<br /> <br />-LIBS= -lssl<br />+LIBS= -lssl -lz<br /> <br /> init-db: init-db.o<br /> <br />diff -purN git-0.02.orig/cat-file.c git-0.02/cat-file.c<br />--- git-0.02.orig/cat-file.c 2005-04-07 23:15:17.000000000 +0200<br />+++ git-0.02/cat-file.c 2005-04-08 11:07:28.000000000 +0200<br />@@ -5,6 +5,8 @@<br /> */<br /> #include "cache.h"<br /> <br />+#include <string.h><br />+<br /> int main(int argc, char **argv)<br /> {<br /> unsigned char sha1[20];<br />@@ -25,4 +27,5 @@ int main(int argc, char **argv)<br /> if (write(fd, buf, size) != size)<br /> strcpy(type, "bad");<br /> printf("%s: %s\n", template, type);<br />+ exit(0);<br /> }<br />diff -purN git-0.02.orig/commit-tree.c git-0.02/commit-tree.c<br />--- git-0.02.orig/commit-tree.c 2005-04-07 23:15:17.000000000 +0200<br />+++ git-0.02/commit-tree.c 2005-04-08 11:06:08.000000000 +0200<br />@@ -6,6 +6,7 @@<br /> #include "cache.h"<br /> <br /> #include <pwd.h><br />+#include <string.h><br /> #include <time.h><br /> <br /> #define BLOCKING (1ul << 14)<br />diff -purN git-0.02.orig/init-db.c git-0.02/init-db.c<br />--- git-0.02.orig/init-db.c 2005-04-07 23:15:17.000000000 +0200<br />+++ git-0.02/init-db.c 2005-04-08 11:07:33.000000000 +0200<br />@@ -5,10 +5,12 @@<br /> */<br /> #include "cache.h"<br /> <br />+#include <string.h><br />+<br /> int main(int argc, char **argv)<br /> {<br /> char *sha1_dir = getenv(DB_ENVIRONMENT), *path;<br />- int len, i, fd;<br />+ int len, i;<br /> <br /> if (mkdir(".dircache", 0700) < 0) {<br /> perror("unable to create .dircache");<br />@@ -25,7 +27,7 @@ int main(int argc, char **argv)<br /> if (sha1_dir) {<br /> struct stat st;<br /> if (!stat(sha1_dir, &st) < 0 && S_ISDIR(st.st_mode))<br />- return;<br />+ exit(1);<br /> fprintf(stderr, "DB_ENVIRONMENT set to bad directory %s: ", sha1_dir);<br /> }<br /> <br />diff -purN git-0.02.orig/read-cache.c git-0.02/read-cache.c<br />--- git-0.02.orig/read-cache.c 2005-04-07 23:23:43.000000000 +0200<br />+++ git-0.02/read-cache.c 2005-04-08 11:07:37.000000000 +0200<br />@@ -5,6 +5,8 @@<br /> */<br /> #include "cache.h"<br /> <br />+#include <string.h><br />+<br /> const char *sha1_file_directory = NULL;<br /> struct cache_entry **active_cache = NULL;<br /> unsigned int active_nr = 0, active_alloc = 0;<br />@@ -89,7 +91,7 @@ void * read_sha1_file(unsigned char *sha<br /> z_stream stream;<br /> char buffer[8192];<br /> struct stat st;<br />- int i, fd, ret, bytes;<br />+ int fd, ret, bytes;<br /> void *map, *buf;<br /> char *filename = sha1_file_name(sha1);<br /> <br />@@ -173,7 +175,7 @@ int write_sha1_file(char *buf, unsigned <br /> int write_sha1_buffer(unsigned char *sha1, void *buf, unsigned int size)<br /> {<br /> char *filename = sha1_file_name(sha1);<br />- int i, fd;<br />+ int fd;<br /> <br /> fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0666);<br /> if (fd < 0)<br />diff -purN git-0.02.orig/read-tree.c git-0.02/read-tree.c<br />--- git-0.02.orig/read-tree.c 2005-04-08 04:58:44.000000000 +0200<br />+++ git-0.02/read-tree.c 2005-04-08 11:07:41.000000000 +0200<br />@@ -5,6 +5,8 @@<br /> */<br /> #include "cache.h"<br /> <br />+#include <string.h><br />+<br /> static void create_directories(const char *path)<br /> {<br /> int len = strlen(path);<br />@@ -72,7 +74,6 @@ static int unpack(unsigned char *sha1)<br /> <br /> int main(int argc, char **argv)<br /> {<br />- int fd;<br /> unsigned char sha1[20];<br /> <br /> if (argc != 2)<br />diff -purN git-0.02.orig/show-diff.c git-0.02/show-diff.c<br />--- git-0.02.orig/show-diff.c 2005-04-07 23:15:17.000000000 +0200<br />+++ git-0.02/show-diff.c 2005-04-08 11:07:44.000000000 +0200<br />@@ -5,6 +5,8 @@<br /> */<br /> #include "cache.h"<br /> <br />+#include <string.h><br />+<br /> #define MTIME_CHANGED 0x0001<br /> #define CTIME_CHANGED 0x0002<br /> #define OWNER_CHANGED 0x0004<br />@@ -60,7 +62,6 @@ int main(int argc, char **argv)<br /> struct stat st;<br /> struct cache_entry *ce = active_cache[i];<br /> int n, changed;<br />- unsigned int mode;<br /> unsigned long size;<br /> char type[20];<br /> void *new;<br />diff -purN git-0.02.orig/update-cache.c git-0.02/update-cache.c<br />--- git-0.02.orig/update-cache.c 2005-04-07 23:15:17.000000000 +0200<br />+++ git-0.02/update-cache.c 2005-04-08 11:08:55.000000000 +0200<br />@@ -5,6 +5,8 @@<br /> */<br /> #include "cache.h"<br /> <br />+#include <string.h><br />+<br /> static int cache_name_compare(const char *name1, int len1, const char *name2, int len2)<br /> {<br /> int len = len1 < len2 ? len1 : len2;<br />@@ -50,6 +52,7 @@ static int remove_file_from_cache(char *<br /> if (pos < active_nr)<br /> memmove(active_cache + pos, active_cache + pos + 1, (active_nr - pos - 1) * sizeof(struct cache_entry *));<br /> }<br />+ return 0;<br /> }<br /> <br /> static int add_cache_entry(struct cache_entry *ce)<br />@@ -250,4 +253,5 @@ int main(int argc, char **argv)<br /> return 0;<br /> out:<br /> unlink(".dircache/index.lock");<br />+ exit(0);<br /> }<br />diff -purN git-0.02.orig/write-tree.c git-0.02/write-tree.c<br />--- git-0.02.orig/write-tree.c 2005-04-07 23:15:17.000000000 +0200<br />+++ git-0.02/write-tree.c 2005-04-08 11:07:51.000000000 +0200<br />@@ -5,6 +5,8 @@<br /> */<br /> #include "cache.h"<br /> <br />+#include <string.h><br />+<br /> static int check_valid_sha1(unsigned char *sha1)<br /> {<br /> char *filename = sha1_file_name(sha1);<br />@@ -31,7 +33,7 @@ static int prepend_integer(char *buffer,<br /> <br /> int main(int argc, char **argv)<br /> {<br />- unsigned long size, offset, val;<br />+ unsigned long size, offset;<br /> int i, entries = read_cache();<br /> char *buffer;<br /> <br />Gr{oetje,eeting}s,<br /> Geert<br /><br />--<br />Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org<br /><br />In personal conversations with technical people, I call myself a hacker. But<br />when I'm talking to journalists I just say "programmer" or something like that.<br /> -- Linus Torvalds<br />-<br />To unsubscribe from this list: send the line "unsubscribe linux-kernel" in<br />the body of a message to majordomo@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: 2005-04-08 11:28 聽聽 [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>