vendredi 17 février 2017

_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build

_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build


If you are pulling your hair and wondering why your kernel does not have a /sys/kernel/debug/dynamic_debug directory despite having CONFIG_DYNAMIC_DEBUG enabled and debugfs mounted, the issue could be that you built the kernel using GOLD linker. You can simply switch through the LD Makefile variable (make LD=ld.bld)

lundi 16 janvier 2017

Extracting and applying a clean git patchset from an email thread with notmuch

I just wrote a quick python script to filter the actual patches from a email thread send with git send-email (those "[PATCH 1/15] xyz" threads). The script assumes you use notmuch. Give it a search expression that returns a list of messages that includes all the patches like the thread-id (C-u c i while looking at the thread in emacs).

You can get it on github. There is a small elisp snippet in the README to run the script and apply the patchset from emacs.

vendredi 13 janvier 2017

Copy current buffer absolute file path to the OS clipboard

(defun copy-full-path ()
  (interactive)
  (let ((path (buffer-file-name)))
    (when path
      (setq path (expand-file-name path))
      (funcall interprogram-cut-function path)
      (message "copied %s in clipboard" path))))

Quick-and-dirty email template for notmuch

(defun prepare-report ()
  (interactive)
  (notmuch-mua-new-mail)
  (insert "foo@example.com")
  (search-forward "Subject: ")
  (insert "work report week " (format-time-string "%W"))
  (search-forward "\n\n")
  (backward-char)
  (insert "my super email content\n"))

Jump to code from Coverity report emails (notmuch)

If you use notmuch as your email client and receive Coverity reports emails, here's a quick function that compiles the reports to a single buffer (newest first), applies some color on the errors, and enables the compilation minor mode so you can use Emacs regular "jump to next error" key.

Adapt the default-directory to your project source.

(defun samba-coverity ()
  (interactive)
  (let ((b (get-buffer-create "*coverity*")))
    (with-current-buffer b
      (erase-buffer)
      (setq default-directory (expand-file-name "~/prog/samba-git"))
      (insert
       (shell-command-to-string
 (concat
  "for i in $(notmuch search --output=messages"
  " 'from:scan-admin@coverity.com'); do notmuch show $i; done"
  " | perl -pE 's,^/(\\S+): (\\d+) in,cov:$1:$2: in,'")))
      (goto-char (point-min))
      (while (search-forward-regexp (rx bol ">>>") nil t)
 (let ((beg (save-excursion (beginning-of-line) (point)))
       (end (save-excursion (end-of-line) (point))))
   (put-text-property beg end 'face 'error)))
      (goto-char (point-min))      
      (compilation-minor-mode))
    (switch-to-buffer b)))