I am trying to get some help debugging an issue with a script hanging after an unzip command executes only when run from within a QProcess in an SE Linux (RHEL 7) Environment. I have discussed the issue with the other company involved in integrating my display application, several developers here and searched on unzip and QProcess. I am not QT developer - this other company is wrapping my application in a QProcess on their SE Linux OS. I posted a question about this on LinuxQuestions.org but they suggested I try here. Any ideas welcome. I don't have much to go on from the other company so looking for general QT information as well.

I am providing my code to another company that is integrating it into a larger SE Linux operating system. On their OS, they have a Manager application that allows a maintainer user to select my display application and they then launch it from within a QProcess.

The problem:

Here is an unzip command being invoked by my application from a bash script:
Qt Code:
  1. unzip -uo SEPV3_FINAL_IETM_Content_20171020_070315.zip -d $VIEWER_CONTENT
To copy to clipboard, switch view to plain text mode 

There are three unzip commands in total in the installation script but when it hangs, it doesn't get past the first (above). It appears to inflate all the content files (of which there are a large amount - at least 100).

When it fails, we are never getting output from the if statement - which has either a fail or success. It just hangs and unzip never fully returns. It still shows as a process when do a ps -ef.

When I run my application in a non-secure, non-wrapped method - just straight invocation from my startup script, there is no issue and the unzip works great with exact same code and scripts. Host and Target testing both passed on my side (using compatible RHEL 7 OS - but as root and not SE Linux). Going to same exact location on my target as it does on theirs.

I don't have access to their code or environment for testing which makes it difficult. I have only the secure OS and my non SE Linux environment.
I am just going by what they are telling me and have seen when integrating with them.

----------------------------------------------------
More information on code related to problem:

Here is what they sent me about their QProcess code:

Reference they gave me:
https://doc.qt.io/qt-5/qprocess.html[doc.qt.io]

"This is how KM is calling all processes that it launches from icons on the screen:

Qt Code:
  1. QProcess m_localProcess;
  2.  
  3. m_localProcess.kill();
  4. m_localProcess.close();
  5. m_localProcess.reset();
  6. m_localProcess.start(exePath,exeArgs);
  7. return (int)m_localProcess.pid();
To copy to clipboard, switch view to plain text mode 

When KM launches ADTA via QProcess, it gets lost in the various scripts, right after it unzips the .xml files it gets lost and goes nowhere. When the shell launches it, everything is fine. QProcess does not have all the elements that a shell needs. There is an ecosystem around monitoring the process that I need to keep in place, so I can’t just create a new way to launch your process. I’m looking into ways to set up the QProcess to be more like a shell environment, but I’m hoping you can simplify the scripts to launch ADTA and such to make it easier. Thanks!"

KM is their Kiosk Manager application that controls my application. My application launch is one script called adta. So exePath is the path to my script (/var/opt/amas/adta). They verified the path matches what I am expecting. They said exeArgs is null. Obviously they only gave me a portion of their code. Not much to go on.

Inside my script to launch application, I set up environment, etc and then make one call to start my main and log to a file as well as terminal:
From bash script:
Qt Code:
  1. ./msd_main |& tee /var/opt/amas/adta.log &
To copy to clipboard, switch view to plain text mode 

When the user puts in a content disk and selects option to upload it (after the OS reads the disk), I then launch a script that is stored with content on that disk.
I make a system call from my application (C) code to launch that script (with cmd = name of script to launch)

Qt Code:
  1. int target_compatibility_system (char *cmd)
  2. {
  3. pid_t pid;
  4. sigset_t set;
  5. int status;
  6.  
  7. sigemptyset(&set);
  8.  
  9. pid=fork();
  10. if (pid==0) {
  11. /* who's to say we know what's best for any launched process? */
  12. /* so unblock all signals before launching it. */
  13. pthread_sigmask(SIG_SETMASK, &set, NULL);
  14. execl("/bin/sh", "sh", "-p", "-c", cmd, NULL);
  15. } else {
  16. waitpid(pid, &status, 0);
  17. }
  18.  
  19. return(status);
  20. }
To copy to clipboard, switch view to plain text mode 

and that then calls the installation script (also on the disk)
Qt Code:
  1. echo y | sh ./linux-installer.sh
To copy to clipboard, switch view to plain text mode 

It needs to input y for question asked by that script. I don't create the second script. It is created with content that is being loaded.

The second script contains the unzip commands. I don't understand Qt enough to verify what he is staying about QProcess not having all the elements that a shell needs. What could they be missing? Is that even correct?

When my co-worker created a simple QProcess based on what they gave us, to launch our application on host, it worked just as it did outside the QProcess. So it seems QProcess itself may not be the issue? So why isn't theirs working?

When they launch our application from a gnome-terminal with SE Linux in permissive mode, it works just fine. So what is interfering with it inside the KM and QProcess? Not sure.

Thanks for any advice/suggestions for what to try to do to fix/debug this further.