# rm: illegal option -- x



## kjpetrie (Dec 1, 2015)

I have a machine dedicated to building packages that has the following in root's crontab:

```
43 5 * * 0-2,4-6 /usr/sbin/pkg upgrade -y && /usr/local/bin/poudriere ports -u -p local && /usr/local/bin/poudriere bulk -j 9buildi386 -p local -z xxxxx -f /usr/local/etc/poudriere.d/9buildi386-local-xxxxx-pkglist && /home/xxxx/FileProc/checkshut
```

/home/xxxx/FileProc/checkshut is a script which does:

```
#!/usr/local/bin/bash
# checkshut - checks no VMs running, user xxxx not logged on and shuts down

while [[ `su - xxxx -c 'VBoxManage list runningvms'` ]]
do
  sleep 120
done

if ! users | grep -q xxxx ; then
  /sbin/shutdown -p +1
fi
```

This morning I found the machine still running and an e-mail in root's mailbox ending:

```
[9buildi386-local-xxxxx] [2015-12-01_06h32m10s] [committing:] Queued: 0  Built: 0  Failed: 0  Skipped: 0  Ignored: 0  Tobuild: 0  Time: 00:00:10
[00:02:27] ====>> Logs: /usr/local/poudriere/data/logs/bulk/9buildi386-local-xxxxx/2015-12-01_06h32m10s
[00:02:27] ====>> Cleaning up
[00:02:27] ====>> Umounting file systems
rm: illegal option -- x
usage: rm [-f | -i] [-dIPRrvW] file ...
  unlink file
[00:02:27] ====>> Cleaning up
[00:02:27] ====>> Umounting file systems
rm: illegal option -- x
usage: rm [-f | -i] [-dIPRrvW] file ...
  unlink file
```

I have checked /usr/local/bin/poudriere for any rm commands and the string "Unmounting" but neither seems to be there, and I seem to recall "Umounting file systems" as a message from `/sbin/shutdown`, but why would it call `rm` with an illegal option?

This is most odd. Any ideas?


----------



## wblock@ (Dec 1, 2015)

Possibly it's not `rm` but `unlink` that is being called.  They are the same command but take different arguments, and `unlink` takes no options.  Probably a part of poudriere cleanup.

I would avoid bash for shell scripts, but maybe that's just me.


----------



## junovitch@ (Dec 2, 2015)

This is all 9.x, correct?  Update to the latest revision of ports-mgmt/poudriere.  See https://svnweb.FreeBSD.org/changeset/ports/402690



> Log:
> Revert usage of -x for rm(1) for now due to 9.x not having it.


----------

