# truss output differs from running program without truss



## pprocacci (Nov 27, 2013)

Gents,

Thanks for helping me with this.  I'm in the process of trying to get Prosody (http://prosody.im/) running on a FreeBSD 9.1 machine I have running. The project is written in Lua. I'm using an external module for authenticating my users called mod_auth_external (https://code.google.com/p/prosody-modules/wiki/mod_auth_external). The module in question uses PTY code for allocating and talking to external authentication scripts.

The above is mostly irrelevant, but I wanted to describe the environment in which this question is stemming from. I'm running into a very strange issue where my users are able to literally type any password into their Jabber client and it successfully authenticates them approximately 80% of the time. This obviously cannot happen, so I started doing a bit of debugging.

While debugging, writing test scripts to duplicate how Prosody handles this authentication, and while using truss to watch the system calls, I noticed that truss's output differed from that of my simply running the program without using truss. I'm sure there is some logical explanation for it, but I cannot determine what that is on my own and was hoping that someone would know the reason why.

truss example (`truss -s 1024 ./mod_auth_external.lua`):

```
write(3,"data_that_is_mostly_irrelevant\n",54) = 54 (0x36)
select(4,{3},0x0,0x0,{5.000000 })                = 1 (0x1)
read(3,"1\r\n",4096)                             = 3 (0x3)
select(4,{3},0x0,0x0,{0.000000 })                = 0 (0x0)
fstat(1,{ mode=crw--w---- ,inode=90,size=0,blksize=4096 }) = 0 (0x0)
ioctl(1,TIOCGETA,0xffffd510)                     = 0 (0x0)
true
write(1,"true\n",5)                              = 5 (0x5)
```

Non-truss example:

```
./mod_auth_external.lua
nil
```

In short, truss is making the program behave differently.  Is this a known issue, and is there a better/different way to tackle this? I'm assuming truss is manipulating the TTY in some way, but some confirmation would be nice.

With truss - it's printing the expected results. Without truss - it's printing nil.

Thanks in advance.


----------

