{"id":166987,"date":"2020-10-05T01:22:37","date_gmt":"2020-10-04T17:22:37","guid":{"rendered":"http:\/\/4563.org\/?p=166987"},"modified":"2020-10-05T01:22:37","modified_gmt":"2020-10-04T17:22:37","slug":"%e8%80%81%e5%bc%9f%e5%85%b4%e5%a5%8b%e7%9a%84%e8%af%b4%ef%bc%9a%e5%93%a5%ef%bc%8c%e6%88%91%e5%8f%91%e7%8e%b0%e4%ba%86-linus-torvalds-git-%e4%bb%a3%e7%a0%81%e9%87%8c%e7%9a%84-bug","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=166987","title":{"rendered":"\u8001\u5f1f\u5174\u594b\u7684\u8bf4\uff1a\u54e5\uff0c\u6211\u53d1\u73b0\u4e86 Linus Torvalds git \u4ee3\u7801\u91cc\u7684 bug"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8001\u5f1f\u5174\u594b\u7684\u8bf4\uff1a\u54e5\uff0c\u6211\u53d1\u73b0\u4e86 Linus Torvalds git \u4ee3\u7801\u91cc\u7684 bug               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 52coder <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u8bfb\u5927\u4e09\u7684\u8001\u5f1f\u6700\u8fd1\u559c\u6b22\u4e0a\u4e86 c\/c++\uff0c\u770b c\/c++\u7684\u6e90\u7801\uff0c\u4ed6\u544a\u8bc9\u6211\u4ed6\u53d1\u73b0\u4e86 Linus Torvalds git \u4ed3\u5e93\u91cc\u7684 bug \uff08\u7a0b\u5e8f bug + \u5185\u5b58\u6cc4\u9732 + \u6bb5\u9519\u8bef\uff09\uff0c\u7136\u540e\u6211\u8bf4\u4f60\u8d76\u7d27\u63d0 PR \u5440\uff0c\u770b\u4e86\u534a\u5929\u4ed6\u8bf4\u7684\u5176\u4e2d\u4e00\u4e2a bug init-db.c \u6ca1\u53d1\u73b0\u95ee\u9898\uff0c\u5404\u79cd\u6000\u7591\u4eba\u751f\uff0c\u4e00\u95ee\u624d\u77e5\u9053\u662f\u7b2c\u4e00\u7248 git. \u5176\u4e2d\u4e00\u4e2a bug<\/p>\n<pre><code>sha1_dir = getenv(DB_ENVIRONMENT); if (sha1_dir) {  struct stat st;  if (!stat(sha1_dir, &amp;st) &lt; 0 &amp;&amp; S_ISDIR(st.st_mode))   return 0;  fprintf(stderr, \"DB_ENVIRONMENT set to bad directory %s: \", sha1_dir); } <\/code><\/pre>\n<p>stat \u8fd4\u56de 0 \u6216 -1\uff0c\u975e\u96f6\u52a0\uff01\u7ed3\u679c\u4e3a 0\uff0c0 \u52a0\uff01\u7ed3\u679c\u4e3a 1\uff0c\u8fd9\u91cc&lt;0 \u6761\u4ef6\u6c38\u8fdc\u4e0d\u6210\u7acb\uff1f\u5404\u4f4d\u8001\u54e5\u4eec\uff0c\u8fd9\u91cc\u6211\u6ca1\u7406\u89e3\u9519\u5427\uff0c\u522b\u8bef\u5bfc\u4e86\u6211\u5f1f\uff0c\u54c8\u54c8\u54c8\u54c8\u3002<\/p>\n<p>\u987a\u5e26\u6c42\u4e00\u4efd\u9002\u5408\u6df1\u5165\u5b66\u4e60\u7684 C++\u5f00\u6e90\u4ee3\u7801\uff08 C \u7684\u8bdd\u8001\u5f1f\u4e13\u5fc3\u770b redis \u4e86\uff0c\u65f6\u4e0d\u65f6\u95ee\u6211\u4e00\u4e9b\u95ee\u9898\uff0c\u6211\u4e5f\u8ddf\u7740\u5b66\u4e60\u4e0b redis\uff0c\u5230\u65f6\u5019\u518d\u88ab\u516b\u80a1\u6587\uff0c\u5c82\u4e0d\u7f8e\u6ecb\u6ecb\uff1f\uff09<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>17<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3687353\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mywaiting <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u867d\u7136\u6211\u4e0d\u61c2 C\/CPP \u4f46\u662f\u6211\u89c9\u5f97 Linus \u6ca1\u6709\u5199\u9519\uff0c\u662f\u7684\uff0c\u8111\u6b8b\u7c89\u5c31\u662f\u8fd9\u4e48\u65e0\u8111 [\u644a\u624b~]~                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687354\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : timothyqiu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u8bf4\u7684\u6ca1\u9519\uff1a https:\/\/github.com\/git\/git\/commit\/7fa6b4e7692926d2d07adee1ef8e277157929058#diff-8117edf99fe3ee201b23c8c157a64c95                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687355\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 52coder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @timothyqiu \u611f\u8c22\u8001\u94c1\uff0c\u6628\u5929\u592a\u665a\uff0c\u6ca1\u53bb\u7ffb\u63d0\u4ea4\u8bb0\u5f55                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687356\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 52coder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @mywaiting \u770b\u7b2c\u4e00\u4e2a\u7248\u672c\u7684 git,\u6211\u7ed9\u6211\u8001\u5f1f\u8bb2\u8981\u5b66\u4e60\u91cc\u9762\u7684\u7406\u5ff5\uff08\u867d\u7136\u6211\u6ca1\u770b\u8fc7\uff0c\u4f46\u8fd9\u8bdd\u653e\u4e4b\u56db\u6d77\u7686\u51c6[doge]\uff09                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687357\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mywaiting <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @52coder \u7b2c\u4e00\u4e2a\u7248\u672c\u7684 Git \u5355\u7eaf\u4ece\u4ee3\u7801\u4e0a\u611f\u89c9\u6ca1\u592a\u591a\u4eae\u70b9\uff0c\u57fa\u672c\u5c31\u662f\u719f\u624b\u7684 C\/CPP \u6c34\u5e73<\/p>\n<p>\u7136\u800c\u53ef\u4ee5\u4ece\u9ad8\u5904\u62bd\u8c61\u51fa tree \u548c blob \u8fd9\u4e24\u4e2a\u5b9e\u73b0\u7136\u540e\u5b9e\u73b0\u4e00\u5957\u5b8c\u6574\u7684\u5206\u5e03\u5f0f\u7248\u672c\u7ba1\u7406\uff0c\u6574\u4e2a\u601d\u8def\u548c\u4f53\u7cfb\u5f88\u503c\u5f97\u5b66\u4e60<\/p>\n<p>\u5316\u7e41\u4e3a\u7b80\uff0c\u7528\u4e00\u5343\u591a\u884c\u4ee3\u7801\u5c31\u9ad8\u6548\u5b8c\u6210\u6574\u4e2a\u7cfb\u7edf\u7684\u642d\u5efa\uff0c\u77ed\u5c0f\u7cbe\u608d\uff0c\u66f4\u662f\u9879\u76ee\u5b9e\u73b0\u4e2d\u7684\u5178\u8303\uff0c\u8fd9\u4e2a\u624d\u771f\u503c\u5f97\u5b66\u4e60                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687358\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 52coder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @mywaiting \u662f\u7684\uff0c\u975e\u5e38\u8d5e\u540c\u4f60\u8bf4\u7684\u8fd9\u4e2a\uff0c\u5f53\u7136\u6211\u4e5f\u5efa\u8bae\u6211\u5f1f\u4ece\u63d0\u4ea4\u8bb0\u5f55\u5f00\u59cb\u5f80\u540e\u8eb2\u770b\u770b\uff0c\u4e3a\u4ec0\u4e48\u8981\u8fd9\u4e48\u9ad8\uff0c\u62bd\u8c61\u548c\u8bbe\u8ba1\u5c31\u8981\u81ea\u5df1\u6d88\u5316\u548c\u5438\u6536\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687359\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : DiamondY <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5728 C \u4e00\u822c\u4f1a\u8fd9\u6837\u5b9a\u4e49\uff0ctrue:-1 false:0<\/p>\n<p>\u90a3\u6837\u5199\u4e5f\u4e0d\u7b97\u9519\uff0c\u4f46\u53bb\u6389\u66f4\u51c6\u786e\uff0c\u6709\u4e9b\u4eba\u6216\u7f16\u8bd1\u5668\u4f1a\u628a true \u5b9a\u4e49\u6210 1                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687360\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : DiamondY <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @DiamondY #7 \u8fd9\u91cc\u5e94\u8be5\u628a\u7f16\u8bd1\u5668\u53bb\u6389\uff0c\u8ddf\u90a3\u6ca1\u5173\u7cfb<br \/>\u5728\u6709\u7b26\u53f7\u5224\u65ad\u91cc\u9762 \uff01 0 == -1                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687361\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 52coder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @DiamondY \u4e0d\u592a\u660e\u767d\u5144\u5f1f\u4f60\u5728\u8bf4\u4ec0\u4e48\uff0c\u4f60\u662f\u4e0d\u662f\u7406\u89e3\u6df7~\u548c\uff01\u7684\u7528\u6cd5\u4e86\uff1f\u4f60\u65b9\u4fbf\u63d0\u4f9b\u4e2a demo \u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687362\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 52coder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @DiamondY C \u91cc\u4e00\u822c true 1 ,false 0\uff0c\u4e0d\u662f-1\uff0c\u5373\u4f7f\u662f-1\uff0c\u4e0a\u9762\u90a3\u4e2a\u4ee3\u7801\u4e5f\u662f\u9519\u7684\uff0c\u4f60\u53ef\u4ee5\u5199 demo \u9a8c\u8bc1\u4e0b\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687363\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hwdef <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6e90\u7801\uff0c\uff0c\u65e2\u7136\u770b\u4e86 redis \u7684\u8bdd\uff0c\uff0c\u53ef\u4ee5\u770b\u770b\u53e6\u4e00\u4e2a k\/v \u6570\u636e\u5e93\uff0cleveldb\uff0c\u4e5f\u503c\u5f97\u5b66\u4e60\uff0c\u4e5f\u4e0d\u957f\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687364\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : DiamondY <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @52coder \u662f\u641e\u6df7\u4e86~\u548c!\uff0c\u4f30\u8ba1\u4e0a\u5348\u8111\u5b50\u8fdb\u6c34\u4e86<br \/>C \u91cc\u9762\u5224\u65ad\u53ea\u662f\u8ba4\u4e3a 0 \u503c\u4e3a false\uff0c\u975e 0 \u5c31\u662f true\uff0c\u867d\u7136\u6807\u51c6\u5e93\u91cc\u9762 true \u662f\u5b9a\u4e49\u6210 1\uff0c\u4f46\u5b9a\u4e49\u6210-1 \u4e5f\u6ca1\u9519\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687365\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 52coder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hwdef \u611f\u8c22\u63a8\u8350\uff0cleveldb \u548c redis \u6709\u79cd\u76f8\u4e92\u8865\u5145\u7684\u611f\u89c9\uff0c\u54c8\u54c8\u54c8\uff0c\u591a\u8c22\u63a8\u8350                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687366\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : berrx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u54e5, \u54b1\u5bb6\u6709\u94b1\u4e86                                                             <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687367\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 52coder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @berrx \u54c8\u54c8\u54c8\u54c8\uff0c\u8981\u662f\u8fd9\u6837\u505a\u68a6\u90fd\u7b11\u9192\u4e86\uff0c\u53ef\u662f\u519c\u6751\u4e0d\u4f1a\u62c6\u8fc1\uff0c\u54c8\u54c8\u54c8\u54c8                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687368\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : maigebaoer <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5bb3\uff0c\u6211\u4eec\u8fd9\u4e9b\u5e94\u7528\u4fa7\u7684\uff0c\u8fd8\u662f\u76f4\u63a5\u80cc\u516b\u80a1\u6587\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3687369\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 52coder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @maigebaoer \u6211\u4e5f\u5e94\u7528\u6d4b\u7684\uff0c\u4e3b\u8981 java\uff0c\u5076\u5c14 go,\u770b\u770b redis \u6e90\u7801\uff0c\u518d\u80cc\u516b\u80a1\u6587\u53ef\u80fd\u597d\u80cc\u4e00\u4e9b\u5427.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8001\u5f1f\u5174\u594b\u7684\u8bf4\uff1a\u54e5\uff0c\u6211\u53d1\u73b0\u4e86 Lin&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/166987"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=166987"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/166987\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=166987"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=166987"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=166987"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}