Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node title with single quote(s) breaks ripgrep for unlinked references #2407

Open
okomestudio opened this issue Jan 25, 2024 · 0 comments
Open

Comments

@okomestudio
Copy link

Description

When constructing the ripgrep shell command for grepping unlinked references, each title (and aliases) of that node gets sanitized by shell-quote-argument, which (properly) escapes quotes. However, escaped single quote “breaks” the constructed ripgrep shell command, since the regex gets expanded within single-quoted argument. For example, for title/alias of “Don’t Repeat Yourself” and “DRY”, the generated ripgrep command looks like this:

rg -L -o --vimgrep -P -i -g "*.org" -g "*.org.gpg" -g "*.org.age" \
    '\[([^[]]++|(?R))*\]|(\bDon\'t\ Repeat\ Yourself\b)|(\bDRY\b)' /org/roam/

Since an escaped single quote cannot appear within single quoted token (in Bash, at least), this command appears to silently fail, and the unlinked references section produces empty result because of this.

A solution may be to use double quotes to wrap the constructed regex. There, escaped characters, including single quote, should be interpreted as intended. A PR implementing a fix may follow.

Steps to Reproduce

  1. Create a node with title text including single quote character (')
  2. Visit that node with org-roam
  3. Run org-roam-buffer-toggle
  4. See that no entries appear under the Unlinked References section

Backtrace

No error occurs that produces a backtrace. The issue appears to be silently ignored.

Expected Results

A list of node filename and the paragraph including the node title text/aliases will appear.

Actual Results

No entries appear under the Unlinked References section of the Org Roam buffer.

Environment

  • Emacs: GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.16.0)
    of 2024-01-18
  • Framework: N/A
  • Org: Org mode version 9.7-pre (release_9.6.15-1044-gaab2c9 @ /home/taro/.config/emacs/straight/build/org/)
  • Org-roam: v2.2.2-44-g8667e44-dirty
  • sqlite-connector: sqlite-builtin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant