[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: debconf as a registry



Bas Wijnen wrote:
> > (Citation needed.)
> 
> http://codesearch.debian.net/search?q=db_get+path%3A.*config%24

If the presence of db_get in a config script was always a bug, then I
[cw]oud modify debconf to not allow db_get in config scripts.

But, it's not. Randomly reviewing only packages I have already installed
from the first 3 pages of results, I found no uses of db_get that didn't
appear to make sense, and none that caused overwriting of values from
system config files.

This is fairly typical:

# debconf is not a registry; use the current contents of the default display
# manager file to pre-answer the question if possible
if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
  CURRENT_DEFAULT=$(basename "$(grep -v '^[[:space:]]*#' \
                                "$DEFAULT_DISPLAY_MANAGER_FILE" |
                                head -n 1)")
  if [ -n "$CURRENT_DEFAULT" ]; then
    db_set shared/default-x-display-manager "$CURRENT_DEFAULT"
  fi
else
  CURRENT_DEFAULT=
  if db_get shared/default-x-display-manager; then
    CURRENT_DEFAULT="$RET"
  fi
fi

Another obvious use for db_get in a config script is input validation.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature


Reply to: