Regular sed error messages at boot process [live-usb]

Forum Forums antiX-development Development Regular sed error messages at boot process [live-usb]

  • This topic has 1 reply, 1 voice, and was last updated Mar 19-9:57 am by tamix.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #79236
    Member
    tamix

      In case a fix has been done meanwhile, just forget this post.

      [Localizing the related shell function]

      . antiX-19.4 file ‘/live/etc/init.d/live-init’: set_server_dpi() lines 978/980
      . antiX-21 file ‘/live/etc/init.d/live-init’: set_server_dpi() lines 987/989

      [antiX-19.4 boot trace]

      >live-init<
      ...
      Setting server dpi to YYY
      sed: -e expression #2, char 38: invalid reference \1 on 's' command's RHS
      sed: -e expression #2, char 38: invalid reference \1 on 's' command's RHS
      ...
      

      There are 2 iterations applied to 2 files respectively hence the double
      error message. RHS stands for ‘Right Hand Side’ in the s command.

      [antiX-21 boot trace]

      >live-init<
      ...
      Setting server dpi to YYY
      sed: -e expression #2, char 38: invalid reference \1 on 's' command's RHS
      ...
      

      There is 1 iteration applied to 1 file hence the single error message.
      RHS stands for ‘Right Hand Side’ in the s command.

      [Suggestion for easy fix: sed command]

      Just add the ‘-r’ option to the sed command for allowing the Extended
      Regular Expressions (ERE).

      1) In the -e expression #1, the substitution does not occur due to the
      missing -r option so the ‘+’ are read here as literal characters.
      What’s more the ‘p’ command should be removed from the s command to
      avoid the line being printed twice.

      2) Since in the -e expression #2, the substitution does not occur due
      to the missing -r option so the parenthesis ‘()’ are read here as
      literal characters.

      before correction:

      # remove existing dpi argument and add a new one
      sed -i -e "/^xserver_arguments/ s/-dpi\s+[0-9]+\s*//p" \
      -e "s/^(xserver_arguments\s+)/\1-dpi $dpi /" $file
      

      as a result after correction:

      # remove existing dpi argument and add a new one
      sed -r -i -e "/^xserver_arguments/ s/-dpi\s+[0-9]+\s*//" \
      -e "s/^(xserver_arguments\s+)/\1-dpi $dpi /" $file
      

      Hope it helps.

      #79377
      Member
      tamix
        Helpful
        Up
        0
        ::

        In case a fix has been done meanwhile, just forget this post.

        Correction
        To all people who feel unconcerned. In case a fix has not been done meanwhile, just forget this post.

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.