Project

General

Profile

Bug #2785

/lib/svc/bin/restore_repository incorrectly uses -eq on strings

Added by Igor Kozhukhov over 8 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Normal
Category:
-
Start date:
2012-05-25
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

  1. /lib/svc/bin/restore_repository
    .....
    If there are any problems which need human intervention, this script will
    give instructions and then exit back to your shell.
    /lib/svc/bin/restore_repository94: [: /: arithmetic syntax error
    The following backups of /etc/svc/repository.db exist, from
    oldest to newest:
    .....
  1. /bin/ksh /lib/svc/bin/restore_repository
    .....
    If there are any problems which need human intervention, this script will
    give instructions and then exit back to your shell.
    /lib/svc/bin/restore_repository94: [: /: arithmetic syntax error
    The following backups of /etc/svc/repository.db exist, from
    oldest to newest:
    .....
  1. /bin/ksh93 /lib/svc/bin/restore_repository

.....
If there are any problems which need human intervention, this script will
give instructions and then exit back to your shell.
/lib/svc/bin/restore_repository94: [: /: arithmetic syntax error
The following backups of /etc/svc/repository.db exist, from
oldest to newest:
.....

#1

Updated by Rich Lowe over 8 years ago

What kind of shell is your /bin/sh? This should actually work.
(I have no problem with fixing it, but if your /bin/sh is that markedly different from our /bin/sh, I'd expect you to have a great many other problems too)

#2

Updated by Rich Lowe over 8 years ago

  • Subject changed from /lib/svc/bin/restore_repository have mistake to /lib/svc/bin/restore_repository incorrectly uses -eq on strings

Oh! No.

ksh93 doesn't work it just also doesn't tell you it's failing.

#3

Updated by Igor Kozhukhov over 8 years ago

Rich Lowe wrote:

What kind of shell is your /bin/sh? This should actually work.
(I have no problem with fixing it, but if your /bin/sh is that markedly different from our /bin/sh, I'd expect you to have a great many other problems too)

Rich,
please take a look my tests with another SHELLs:
  1. /bin/ksh /lib/svc/bin/restore_repository
  2. /bin/ksh93 /lib/svc/bin/restore_repository

they have the same issue.
I have for user root '/bin/ksh'
for local user - /bin/bash

I have on my system:
  1. ls -l /bin/sh
    lrwxrwxrwx 1 root root 9 2012-05-25 19:35 /bin/sh -> i86/ksh93

I have no problems

#4

Updated by Rich Lowe over 8 years ago

Ok, now I get it!

  • If you do what the script does precisely, it fails.
  • If you give two non-numeric strings to the ksh93 -eq, it erroneously succeeds

Either way, you're fix is fine, I was just confused by what ksh93 was doing (to the point I thought it must not be ksh93)

#5

Updated by Igor Kozhukhov over 8 years ago

  • Status changed from In Progress to Pending RTI
  • % Done changed from 60 to 100
#6

Updated by Dan McDonald over 8 years ago

  • Status changed from Pending RTI to Resolved
#7

Updated by Dan McDonald over 8 years ago

changeset: 13706:b83bad61dfe1
tag: tip
user: Igor Kozhukhov <>
date: Tue May 29 11:05:54 2012 -0400

description:
2785 /lib/svc/bin/restore_repository incorrectly uses -eq on strings
Reviewed by: Richard Lowe <>
Reviewed by: Garrett D'Amore <>
Approved by: Dan McDonald <>

Also available in: Atom PDF