# Inappropriate ioctl for device

**URL:** <https://discuss.bitrise.io/t/inappropriate-ioctl-for-device/3925>\
**Category:** Tooling Issues\
**Tags:** step, script\
**Created:** [January 26, 2018, 5:48pm UTC](https://discuss.bitrise.io/t/inappropriate-ioctl-for-device/3925 "2018-01-26T17:48:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![accolademobile](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@accolademobile](https://discuss.bitrise.io/u/accolademobile)\
**Post date:** [January 26, 2018, 5:48pm UTC](https://discuss.bitrise.io/t/inappropriate-ioctl-for-device/3925/1 "2018-01-26T17:48:58Z")

</div>

I am trying to run [Qark](https://github.com/linkedin/qark) Security Scan on my apk using the Script Step. In the bash script I run a python command:

`python ${source_dir}/build/qark/qark/qarkMain.py -s 1 -p ${path_to_apk}/${FILE_NAME} -e 1 -d 10 -b ${ANDROID_HOME}`

I get this error:

```
Traceback (most recent call last):
  File "/bitrise/src/build/qark/qark/qarkMain.py", line 1281, in <module>
    nonAutomatedParseArgs()
  File "/bitrise/src/build/qark/qark/qarkMain.py", line 462, in nonAutomatedParseArgs
    main()
  File "/bitrise/src/build/qark/qark/qarkMain.py", line 790, in main
    unpackAPK.decompile(common.pathToDEX)
  File "/bitrise/src/build/qark/qark/modules/unpackAPK.py", line 162, in decompile
    with common.term.cbreak():
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/bitrise/src/build/qark/qark/lib/blessed/terminal.py", line 572, in cbreak
    save_mode = termios.tcgetattr(self.keyboard_fd)
termios.error: (25, 'Inappropriate ioctl for device')

```

I think the hint is in line `Inappropriate ioctl for device`. When I do `set | grep TERM`, I get `dumb` and I think that means the Terminal running the script is very limited. How do I get over this issue?

Edit 1:  
I found that the script is waiting for button to be pressed if user wants to cancel.

```auto
Decompilation may hang/take too long (usually happens when the source is obfuscated).
At any time,Press C to continue and QARK will attempt to run SCA on whatever was decompiled.

```

This is why it’s failing. Can it be resolved from bitrise end?

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 29, 2018, 8:00pm UTC](https://discuss.bitrise.io/t/inappropriate-ioctl-for-device/3925/2 "2018-01-29T20:00:04Z")

</div>

Hi @accolademobile,

> [@accolademobile](#):
>
> When I do set | grep TERM, I get dumb and I think that means the Terminal running the script is very limited. How do I get over this issue?

The terminal is indeed very limited, so much so that you don’t have interactive input at all 😉 It’s running in non-interactive mode, because during a build you can’t just stop and wait for a user input, that would defeat the purpose of the automation.

From the logs it seems that might cause your issue, that your script might expect interactive input from a user - can that be?

---

<div class="post-metadata">

**Author:** ![accolademobile](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@accolademobile](https://discuss.bitrise.io/u/accolademobile)\
**Post date:** [January 29, 2018, 9:04pm UTC](https://discuss.bitrise.io/t/inappropriate-ioctl-for-device/3925/3 "2018-01-29T21:04:52Z")

</div>

Yes I found the cause. I really don’t want to fork the Qark library. Is there a way to a way around this?

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 30, 2018, 11:34am UTC](https://discuss.bitrise.io/t/inappropriate-ioctl-for-device/3925/4 "2018-01-30T11:34:55Z")

</div>

You should ask that from Qark, it depends on the tool. From our side, as this is a non-interactive environment, there’s no way to make it to be one, as there’s no user interaction is possible during the build.

---

<div class="post-metadata">

**Author:** ![accolademobile](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@accolademobile](https://discuss.bitrise.io/u/accolademobile)\
**Post date:** [February 5, 2018, 5:18pm UTC](https://discuss.bitrise.io/t/inappropriate-ioctl-for-device/3925/5 "2018-02-05T17:18:42Z")

</div>

I forked the library and disabled the code that was causing issue. Now I am hit with new issue explained here [Python issue: Couldn't find a tree builder with the features you requested](http://discuss.bitrise.io/t/python-issue-couldnt-find-a-tree-builder-with-the-features-you-requested/4036)
