Skip to content

autotools: fix potential shell syntax errors in configure.ac#384

Open
taraxacum45e9a wants to merge 2 commits intolinux-rdma:masterfrom
taraxacum45e9a:fix/autoconf
Open

autotools: fix potential shell syntax errors in configure.ac#384
taraxacum45e9a wants to merge 2 commits intolinux-rdma:masterfrom
taraxacum45e9a:fix/autoconf

Conversation

@taraxacum45e9a
Copy link
Copy Markdown

Description

This PR fixes a potential shell script syntax error in configure.ac by adopting a more robust string comparison pattern for the HAVE_REG_DMABUF_MR check.

The Problem

The existing check used a direct variable expansion:
if test $HAVE_REG_DMABUF_MR = yes; then

If $HAVE_REG_DMABUF_MR is empty or undefined, the shell evaluates the expression as if test = yes; then. This causes a "unary operator expected" error during the execution of the ./configure script, potentially halting the build process or leading to incorrect configuration states.

The Fix

I have updated the conditional to use the defensive "x$VAR" = "xyes" idiom.

  • Quoting: Handles cases where the variable is empty or contains whitespace.
  • The "x" Prefix: Prevents the shell from misinterpreting the variable content as a command-line flag (e.g., if the variable contained -n).

Signed-off-by: Shen Jiamin <shen_jiamin@comp.nus.edu.sg>
…ison

Signed-off-by: Shen Jiamin <shen_jiamin@comp.nus.edu.sg>
@taraxacum45e9a taraxacum45e9a changed the title Fix conditional check for HAVE_REG_DMABUF_MR in configure.ac autotools: fix potential shell syntax errors in configure.ac Apr 9, 2026
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

Successfully merging this pull request may close these issues.

1 participant