Bug #2785
closed/lib/svc/bin/restore_repository incorrectly uses -eq on strings
100%
Description
- /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:
.....
- /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:
.....
- /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:
.....
Updated by Rich Lowe almost 10 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)
Updated by Rich Lowe almost 10 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.
Updated by Igor Kozhukhov almost 10 years ago
Rich Lowe wrote:
Rich,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)
please take a look my tests with another SHELLs:
- /bin/ksh /lib/svc/bin/restore_repository
- /bin/ksh93 /lib/svc/bin/restore_repository
they have the same issue.
I have for user root '/bin/ksh'
for local user - /bin/bash
- ls -l /bin/sh
lrwxrwxrwx 1 root root 9 2012-05-25 19:35 /bin/sh -> i86/ksh93
I have no problems
Updated by Rich Lowe almost 10 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)
Updated by Igor Kozhukhov almost 10 years ago
- Status changed from In Progress to Pending RTI
- % Done changed from 60 to 100
Updated by Dan McDonald almost 10 years ago
- Status changed from Pending RTI to Resolved
Updated by Dan McDonald almost 10 years ago
changeset: 13706:b83bad61dfe1
tag: tip
user: Igor Kozhukhov <igor.kozhukhov@nexenta.com>
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 <richlowe@richlowe.net>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Dan McDonald <danmcd@nexenta.com>