Ticket #98 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

GNU sed hardcoded in conf_rename

Reported by: blee Owned by: blee
Priority: major Milestone: confman-1.9.3
Component: confman Version: 1.9.2b
Keywords: Cc:

Description

conf_rename uses:

${sed_cmd} -i -r

which is specific to GNU sed.

Change History

comment:1 Changed 2 years ago by blee

  • Owner changed from confman-developers@… to blee
  • Status changed from new to accepted

comment:2 Changed 2 years ago by blee

  • Status changed from accepted to needsmerge

(In [475]) Rewrite confman rename. Fixes some unreported bugs and greatly improves
error handling.

Fixes #97, #98

comment:3 Changed 2 years ago by ccowart

  • Status changed from needsmerge to closed
  • Resolution set to fixed

(In [487]) Merging rename and sed cleanups from trunk.

Resolves #97, #98

comment:4 Changed 2 years ago by ccowart

  • Status changed from closed to reopened
  • Resolution fixed deleted

14:57 <@ccowart> ${sed_cmd} -i""
14:57 <@ccowart> not so cross-platform
14:58 <@ccowart> bsd sed expects an argument to -i
14:58 <@ccowart> but a null argument like -i"" is eaten up by the shell
14:59 <@ccowart> and the argv looks like {"-i", "s/.../"}, not the desired

{"-i", "", "s/.../"}

14:59 <@ccowart> which would be acheived by -i ""
14:59 <@ccowart> but I think -i "" makes gsed unhappy

comment:5 Changed 2 years ago by ccowart

  • Status changed from reopened to needsmerge

(In [491]) Defining $sed_i_cmd that deals with OS-specific logic for whether
-i must take a flag and whether it should be a separate shell word. Also
making the use of ${sed_cmd} consistent (there were some occurrences of
sed without the variable wrapper).

Fixes #98

comment:6 Changed 2 years ago by ccowart

  • Status changed from needsmerge to assigned

16:07 <@ccowart> sed_i_cmd="${sed_cmd} -i \"\""
16:07 <@ccowart> results in:
16:07 <@ccowart> ? ../database/usr/local/pgsql/data/pg_hba.conf""

comment:7 Changed 2 years ago by ccowart

  • Status changed from assigned to needsmerge

(In [492]) Apparently doing sed_i_cmd in a variable has quoting issues and
doesn't perform as expected. I have factored the -i "" logic out
by defining a sed_i_cmd function differently on a per-OS basis.

I have also used the new sed_i_cmd idiom to solve the recipe updates on
renames issue.

Fixes #96, #98

comment:8 Changed 2 years ago by ccowart

  • Status changed from needsmerge to closed
  • Resolution set to fixed

(In [494]) Merging fixes to sed -i as well as support for rename to update recipe
files.

Resolves #96, #98

Note: See TracTickets for help on using tickets.