用 git log 的 -S 與 -G 找變更記錄

符合 blog 副標題的一篇文章。

之前是拿 BBS 看板來存動畫的記錄,不過自從跑在 FreeBSD 32bits 上的 BBS code 一直沒辦法轉移到 Ubuntu 64bits,就放棄用 BBS 看板管動畫記錄了...

現在是拿 Git 來存動畫記錄,後來發現內建的 git log 搜尋起來比 BBS 方便太多,就回不去了...

以「魔法戰爭」來說:

$ git log -S '魔法戰爭' --pretty=%h | xargs -n1 git show
commit 9a6af4ec77561777b854a7ea44da29e197a9dcc2
Author: Gea-Suan Lin <gslin@gslin.org>
Date:   Mon Apr 7 00:55:49 2014 +0800

    Update.

diff --git a/Anime.txt b/Anime.txt
index 080f94a..cd21e14 100644
--- a/Anime.txt
+++ b/Anime.txt
@@ -42,4 +42,3 @@ Z/X IGNITION                            e01
 銀之匙 Silver Spoon 第二季              e04
 鬼燈的冷徹                              e05
 魔女的使命                              e04
-魔法戰爭                                e11
commit 856a27ab4071fb19ca58de3725cdedf53815894b
Author: Gea-Suan Lin <darkkiller@gmail.com>
Date:   Mon Feb 10 04:46:57 2014 +0800

    Update.

diff --git a/Anime.txt b/Anime.txt
index ddb11ea..e5995eb 100644
--- a/Anime.txt
+++ b/Anime.txt
@@ -22,3 +22,4 @@ WIZARD BARRISTERS~弁魔士賽希爾         e01
 偽戀                                    e02
 天才麻將少女 全國篇                     e05
 鬼燈的冷徹                              e05
+魔法戰爭                                e04

-S 只會列出「出現」與「消失」的時候,而且 -S 後面接的是 string 而非 regex。

如果要找所有與「魔法戰爭」相關的變更,則改用 git log -G,要注意的是後面接的是 regex:

 $ git log -G '魔法戰爭' --pretty=%h | xargs -n1 git show

Git 超好用的... XD

ISC 將 BIND 之後的開發主導權轉移給社群

ISCBIND 的主導權轉移到社群上,並且改名為 bundy:「ISC releases BIND 10 1.2, renames it, and turns it over to community」。

開發也將轉移到 GitHub 上,不過看起來 bundy 的名字已經被用掉了,不知道會用哪個 organization name...

Python 2.7 再活五年...

Python 2.7 將支援到 2020 年:「Extend Python 2.7 life till 2020.」。

The End Of Life date (EOL, sunset date) for Python 2.7 has been moved five years into the future, to 2020. This decision was made to clarify the status of Python 2.7 and relieve worries for those users who cannot yet migrate to Python 3. See also PEP 466.

This declaration does not guarantee that bugfix releases will be made on a regular basis, but it should enable volunteers who want to contribute bugfixes for Python 2.7 and it should satisfy vendors who still have to support Python 2 for years to come.

有種淡淡的哀傷...

Ubuntu 14.04 LTS 出版

Ubuntu 的正式公告:「Ubuntu 14.04 LTS (Trusty Tahr) released」。

新裝的機器當然沒有問題,而 13.10 要升級到 14.04 已經提供升級指引了:「Upgrade from Ubuntu 13.10 to 14.04 LTS」。

不過 12.04 LTS 要升級到 14.04 LTS 的人要等到七月:

Users of 12.04 LTS will be offered the automatic upgrade when 14.04.1 LTS is released, which is scheduled for July 24th. For further information about upgrading

來重灌好了 (把 Windows 的習慣拿過來用...)。

檢查大小時要注意的問題

Buggy Security Guidance from Apple」這篇再次說明了 C 語言因為 undefined behavior 而讓 coding 需要注意的事情變多...

這段 code:

size_t bytes = n * m;
if (n > 0 && m > 0 && SIZE_MAX/n >= m) {
    ... /* allocate "bytes" space */
}

問題在於 C 語言裡對 overflow 並沒有定義行為 (undefined behavior),所以 size_t bytes = n * m; 這段 code 並不保證當 overflow 後 bytes 的值會是多少,於是就很容易造成各種意外。

原文有提到更多資訊,以及提出的解法,這邊就不提了...

OpenBSD 的 OpenSSL 清理工作

在「One week of OpenSSL cleanup」這篇提到了 OpenBSD 的 committer 最近花了不少時間在清理 OpenSSL (OpenBSD 內的 OpenSSL)。

All combined, there've been over 250 commits cleaning up OpenSSL. In one week.

清理的過程主要是針對 OpenBSD 所支援的平台,所以其他平台的支援都被拔乾淨了。即使如此,清過後的版本重新 porting 到各 Unux-like 平台應該是還蠻有希望的。

BSD Commit Log Search 這邊則可以搜尋到 OpenSSL 被清的情況:「http://freshbsd.org/search?project=openbsd&q=libssl」。

花些時間翻一翻,會可以看到 OpenSSL 很多習慣並不好 (尤其是在資安領域)。

像是 OpenSSL 預設居然沒有把所有的 code 都上 -Wall,這點讓人有點... 呃... 要怎麼說呢...:「58c7f6cb678b7e31b80d290b5823b16d70760801」。

然後看到大量的 potential double free fix,呃...

繼續看下去吧,看起來 OpenBSD 這一波 cleanup 應該會再爆出一些安全問題 (多冒出幾個 CVE 出來)。

AWS 上資安產品試用...

前幾天 AWS 公佈了「Evaluate Security Products With no Software Charges by Using AWS Marketplace」,在 5/15 前有六個資安產品可以試用 120 小時。

有 WAF、Firewall,也有 UTM,另外還有 data encryption 的方案。找機會來測試看看好了,不知道是擋在哪一層...

Linode 提昇規格,並提供 SSD 方案...

Linode 宣佈了規格提昇 (記憶體與流量) 以及 SSD 方案:「The New Linode Cloud: SSDs, Double RAM & much more」。

那個 Linode 2G 的方案流量不是 2TB 而是 3TB,明顯是針對 DigitalOcean 的同等級方案而設計的...

不過既有的客戶並不是馬上就有得用,要再等一陣子:

CPU 與網路頻寬的提昇也是本次有提到的項目。CPU 將會是 Ivy Bridge E5-2680.v2,而每台 Linode host server 變成用 40Gbps 接到骨幹了。

這幾波動作累積下來,似乎趕上 DigitalOcean 不少?

避免 WordPress 被嵌入的 Plugin...

意外在 Facebook 上看到「如何阻擋網站被 7headlines 等類似的網站用 iframe 嵌入?」這篇,才發現在 WordPress 裡的 Frame Buster 不會動了...

不知道 Frame Buster 是升級到 WordPress 3.9 後才不會動,還是不會動很久了 (剛好是在今天升級到 WordPress 3.9),只好去找替代品...

測了一下確認「WP No Frame」是會動的,不過看了 HTTP response header,好像是純 javascript 的方案,沒有包括 X-Frame-Options,有點可惜,但先這樣放著跑吧...

4chan 支援 WebM...

在「WebM support on 4chan」這篇公告裡 4chan 宣佈支援 WebM 格式。

由於目標是提供 GIF 的替代方案,所以目前開放的 WebM 內容有限制:

we only accept WebM files with one video stream and no audio streams, that are shorter than 120 seconds long, no larger than 2048x2048 pixels, and less than 3 MB in size.

讓我另外注意到的是:

however 86% of 4chan’s visits come from browsers that include full or partial support for WebM

依照「Can I use the WebM/VP8 video format」,這代表大多數 4chan 的使用者都是用 FirefoxChrome