Good idea! Unfortunately it also does not work, and I suspect the root of the 
problem
is a bug in /usr/sbin/pkgrm command. Here is the output:

# printf "y\ny\n"
y
y 
# printf "y\ny\n" | pkgrm SPROprfnx 

The following package is currently installed:
   SPROprfnx  Sun Studio 12 Non-ship 64-bit commands for Performance Analyzer
              (i386) 12.0,REV=2007.10.30

Do you want to remove this package? [y,n,?,q] 
## Removing installed package instance <SPROprfnx>

This package contains scripts which will be executed with super-user
permission during the process of removing this package.

Do you want to continue with the removal of this package [y,n,?,q] 
Removal of <SPROprfnx> failed.
No changes were made to the system.
#

I run it under truss, and it shows that the problem is that pkgrm asks first 
question,
then reads both answers, and then creates a child process 
("/usr/sadm/install/bin/pkgremove"), 
that will ask second question:

# printf "y\ny\n" > /tmp/yes.txt
# truss -a -e -f -o /tmp/pkgrm.tr pkgrm SPROprfnx < /tmp/yes.txt
# cat /tmp/pkgrm.tr
...
12580:  read(0, " y\n y\n", 4096)                       = 4
12580:  getuid()                                        = 0 [0]
12580:  zone_lookup("")                                 = 0
12580:  zone_getattr(0, ZONE_ATTR_NAME, 0x0804608C, 64) = 7
12580:  schedctl()                                      = 0xFE897000
12580:  lwp_sigmask(SIG_SETMASK, 0x00000002, 0x00000000) = 0xFFBFFEFF 
[0x0000FFFF]
12580:  lwp_sigmask(SIG_SETMASK, 0x00000003, 0x00000000) = 0xFFBFFEFF 
[0x0000FFFF]
12580:  lwp_sigmask(SIG_SETMASK, 0xFFBFFEFF, 0x0000FFFF) = 0x00000003 
[0x00000000]
12580:  vfork()                                         = 12585
12585:  vfork()         (returning as child ...)        = 12580
...
12585:  execve("/usr/sadm/install/bin/pkgremove", 0x080464E0, 0x08047B58)  argc 
= 8
12585:   argv: /usr/sadm/install/bin/pkgremove -O
12585:    parent-zone-name=global -O parent-zone-type=global -N pkgrm
12585:    SPROprfnx
...
12585:  write(2, "\n", 1)                               = 1
12585:  xstat(2, "/usr/lib/locale/C/LC_CTYPE/wdresolve.so", 0x08044A68) Err#2 
ENOENT
12585:  write(2, " T", 1)                               = 1
12585:  write(2, " h", 1)                               = 1
12585:  write(2, " i", 1)                               = 1
12585:  write(2, " s", 1)                               = 1
12585:  write(2, "  ", 1)                               = 1
...
12585:  write(2, " n", 1)                               = 1
12585:  write(2, " ,", 1)                               = 1
12585:  write(2, " ?", 1)                               = 1
12585:  write(2, " ,", 1)                               = 1
12585:  write(2, " q", 1)                               = 1
12585:  write(2, " ]", 1)                               = 1
12585:  write(2, "  ", 1)                               = 1
12585:  ioctl(0, TCGETA, 0x08046284)                    Err#25 ENOTTY
12585:  fstat64(0, 0x080462B0)                          = 0
12585:  brk(0x080FD090)                                 = 0
12585:  brk(0x080FF090)                                 = 0
12585:  fstat64(0, 0x080461F0)                          = 0
12585:  read(0, 0x080FC1E4, 4096)                       = 0

Obviously at this moment there is no way to get "y" from the input file.
A suggested fix is to read only one line in /usr/sbin/pkgrm, when it needs 
an answer on its first question.

Thanks,
Nik
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to