Bug 588651 - guestfish 'strings-e' cmd does not give proper error message or hint
guestfish 'strings-e' cmd does not give proper error message or hint
Status: CLOSED UPSTREAM
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-04 04:29 EDT by Pengzhen Cao
Modified: 2011-07-14 15:10 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-07-14 15:10:32 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Pengzhen Cao 2010-05-04 04:29:45 EDT
Description of problem:
when using wrong options in guestfish 'strings-e' cmd, it does not give proper error message or hint

Version-Release number of selected component (if applicable):
libguestfs-1.0.85-1.fc12.3.x86_64

How reproducible:
100%

Steps to Reproduce:
1. run guestfish, add a image, run , mount it
2. run strings-e xx /your_file, whre xx is an invalid option

  
Actual results:
><fs> strings-e h /elf/bash
strings_e "h" "/elf/bash"
libguestfs: error: strings_e: /elf/bash: Usage: strings [option(s)] [file(s)]
 Display printable strings in [file(s)] (stdin by default)
 The options are:
  -a - --all                Scan the entire file, not just the data section
  -f --print-file-name      Print the name of the file

Expected results:
should give some error message say "invalid option" or a list of valid options


Additional info:
valid options in the corresponding bash cmd:
valid encodings: “s = single-7-bit-byte characters (ASCII, ISO 8859, etc., default), S = single-8-bit-byte characters, b = 16-bit bigendian, l = 16-bit littleendian, B = 32-bit bigendian, L = 32-bit littleendian.  Useful for finding wide character strings. (l and b apply to, for example, Unicode UTF-16/UCS-2 encodings).
Comment 1 Richard W.M. Jones 2010-05-12 11:58:16 EDT
I made a change upstream which improves error messages
and the associated documentation:

><fs> strings-e l /etc/fstab 
><fs> strings-e s /etc/fstab 
/dev/sda1 / ext2 defaults 1 2
><fs> strings-e ss /etc/fstab 
libguestfs: error: strings_e: ss: invalid encoding
><fs> strings-e x /etc/fstab 
libguestfs: error: strings_e: x: invalid encoding
><fs> strings-e '' /etc/fstab 
libguestfs: error: strings_e: : invalid encoding

$ ./fish/guestfish -h strings-e
NAME
    strings-e - print the printable strings in a file

SYNOPSIS
     strings-e encoding path

DESCRIPTION
    This is like the "strings" command, but allows you to specify the
    encoding of strings that are looked for in the source file "path".

    Allowed encodings are:

    s   Single 7-bit-byte characters like ASCII and the ASCII-compatible
        parts of ISO-8859-X (this is what "strings" uses).

    S   Single 8-bit-byte characters.

    b   16-bit big endian strings such as those encoded in UTF-16BE or
        UCS-2BE.

    l (lower case letter L)
        16-bit little endian such as UTF-16LE and UCS-2LE. This is useful
        for examining binaries in Windows guests.

    B   32-bit big endian such as UCS-4BE.

    L   32-bit little endian such as UCS-4LE.

    The returned strings are transcoded to UTF-8.

    Because of the message protocol, there is a transfer limit of somewhere
    between 2MB and 4MB. See "PROTOCOL LIMITS" in guestfs(3).

Patch posted upstream:
https://www.redhat.com/archives/libguestfs/2010-May/msg00058.html
Comment 2 Fedora Update System 2010-05-14 15:12:41 EDT
libguestfs-1.2.6-1.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/libguestfs-1.2.6-1.fc13
Comment 3 Fedora Update System 2010-05-17 08:27:51 EDT
libguestfs-1.2.7-1.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/libguestfs-1.2.7-1.fc12
Comment 4 Fedora Update System 2010-05-17 08:47:41 EDT
libguestfs-1.2.7-1.el5 has been submitted as an update for Fedora EPEL 5.
http://admin.fedoraproject.org/updates/libguestfs-1.2.7-1.el5
Comment 5 Fedora Update System 2010-05-17 09:00:12 EDT
libguestfs-1.2.7-2.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/libguestfs-1.2.7-2.fc13
Comment 6 Fedora Update System 2010-05-21 07:33:24 EDT
libguestfs-1.2.7-2.fc13.1 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/libguestfs-1.2.7-2.fc13.1

Note You need to log in before you can comment on or make changes to this bug.