LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-25-2018, 08:27 PM   #1
lacovicm
LQ Newbie
 
Registered: Apr 2018
Distribution: Redhat Enterprise Linux 7
Posts: 2

Rep: Reputation: Disabled
Script hangs after unzip command executes when run from QProcess in SE Linux (RHEL 7)


First post on this or any forum. I hope this one is right place to get help with my issue.

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). So now coming for help here. Any ideas welcome.

Sorry this is a lot of info but this isn't a simple issue. You can skip to end for the problem and scroll back up if that is easier.

-----------------------------
The command/scripts:

When the user inserts a disk with certain content to be viewed, then selects the menu option to upload it, my display application executes a bash script with the following command to launch an installation script included with the content (not controlled by me):

echo "Calling linux installer script"
echo y | sh ./linux-installer.sh
check_error

(check_error just prints error and kicks out if error returned from last command)

Here is a code snippet from the linux-installer.sh (bash also):

VIEWER_CONTENT="/var/oneil/EMSNG/IETM_Content"

echo "Checking for Viewer Content directory"
if [ -d $VIEWER_CONTENT ]
then
echo "Unzipping Viewer Content"
unzip -uo SEPV3_FINAL_IETM_Content_20171020_070315.zip -d $VIEWER_CONTENT

if [ $? -ne 0 ]
then
echo "unzip of SEPV3_FINAL_IETM_Content_20171020_070315.zip failed"
exit 1
else
echo "unzip of Viewer Content was successful"
fi

else
dir_error $VIEWER_CONTENT
fi
echo "Completed installation of Viewer Content"

(dir_error just prints error and kicks outs of script - exit 1)

Here is a portion of the output from the script:

Checking for Viewer Content directory
Unzipping Viewer Content
Archive: SEPV3_FINAL_IETM_Content_20171020_070315.zip
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/T/Tpfattbp295.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/T/Tpfattbp779.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/M/Mpfamt5p158.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/M/Mpfamehp229.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/M/Mpfamamp059.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/M/Mpfamarp004.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/T/Tpfattbp706.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/T/Tpfat18p008.xml inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/T/Tpfattbp333.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/M/mpfame9p224.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/T/Tpfattbp763.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/M/Mpfamehp010.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/M/Mpfamntp005.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/M/Mpfam07p046.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/M/Mpfamtap049.xml
inflating: /tmp/var/oneil/EMSNG/IETM_Content/SEPV3/content/13P/T/Tpfattbp792.xml

...

-----------------------------
The problem:

There are three unzip commands in total in this linux-installer.sh 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 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 (using compatible RHEL 7 OS - but as root and not SE Linux).

I am providing my code to another company that is integrating it into a larger SE Linux operating system. That OS will only allow my application to launch within a QProcess and they of course are restricting permissions unless specified in policy. I have provided them the permissions needed for the directories I need to access, but it could still be an issue. Not ruling that out. Also - getting more information on this - but they are also doing a popen as part of launching my application and my co-workers think that may be the issue? That they need to do a fork instead to get return from child process?

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 had them kill the unzip and linux-installer.sh processes, they could then cancel the upload of content from application (display). Otherwise it just hangs there forever, never returning.

Thanks for any advice/suggestions for what to try to do to fix/debug this further.
I don't have access to their code or environment for testing which makes it difficult.
I am just going by what they are telling me and have seen when integrating with them.
 
Old 04-27-2018, 07:59 PM   #2
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Sorry, I can't offer any help. There are some very knowledgable Qt folks on the following site, and since you haven't received any help here, I suggest that you post your question there. http://www.qtcentre.org/forums/2-Qt-Programming

I set up a simple Qt program using QProcess, shell scripts similar to what you posted and a couple of zip files containing a few directories each. It works fine calling your first script using QProcess::start("./caller.sh") or QProcess::execute("./caller.sh") but I cannot get it to work at all calling popen() from QProcess. The scripts work from the command line and called from a C program using popen().

Any clue as to why they call popen() rather than just using the QProcess methods?
 
1 members found this post helpful.
Old 04-27-2018, 10:35 PM   #3
lacovicm
LQ Newbie
 
Registered: Apr 2018
Distribution: Redhat Enterprise Linux 7
Posts: 2

Original Poster
Rep: Reputation: Disabled
Post Thanks - update

Quote:
Originally Posted by norobro View Post
Sorry, I can't offer any help. There are some very knowledgable Qt folks on the following site, and since you haven't received any help here, I suggest that you post your question there. http://www.qtcentre.org/forums/2-Qt-Programming

I set up a simple Qt program using QProcess, shell scripts similar to what you posted and a couple of zip files containing a few directories each. It works fine calling your first script using QProcess::start("./caller.sh") or QProcess::execute("./caller.sh") but I cannot get it to work at all calling popen() from QProcess. The scripts work from the command line and called from a C program using popen().

Any clue as to why they call popen() rather than just using the QProcess methods?
Thanks so much for trying to help. I started this Wed night and then I didn't see it posted. Then I couldn't get in here Thursday at first and still didn't see it when I did. Must have taken a while to post it. Glad I checked again at least to see you reply. I really appreciate you trying to help me!

It has been difficult to debug this as I am not even able to run their code outside of the secure OS they gave me. I can only go to them or ask them questions. Integrating across companies can be tricky.

I did at least find out that they aren't using popen (). That was the new guy misunderstanding how it was set up until he looked into it further and found they use QProcess. Poor guy just took over about 2 months ago from someone who had been working on it 2 years! The previous guy is not available. Left the company. I took over for my co-worker so didn't interact much with that guy. My co-worker is amazing and helpful but this has him stumped too. So we are just trying to see what we can do together to make it work. I am extremely confident my code is working as it should because I tested the heck out of it in a basic RHEL Linux OS (accessible by root) on the same hardware with same viewer application and directory structures. Same rpm installation, everything. So it is either some code of theirs interfering or not playing nice with mine. Oh I think I forgot to say that when they run my script on their OS in SE Linux permissive mode from a gnome terminal it works fine. So it appears that this Kiosk Manager app that wraps my script in a QProcess seems to be creating the issue. I am trying to get them to send me more of that code but no luck so far. But my co-worker set up a basic QProcess to run our app on our host simulation and that worked fine. So what the heck?!

Another idea my co-worker had is that maybe stdout is being rerouted or filling up a buffer somewhere. So he sent ours to a fifo queue just to play around with that and it did hang our application until we did a cat on the fifo. But we couldn't find an issue when launching from QProcess. The guy at other company said they aren't rerouting or anything. It is just so odd.

I will post over in Qt area as well as you suggested.

Thanks again. I will try to post here if I figure it out. Feel free to post if you think of anything.

Last edited by lacovicm; 04-27-2018 at 10:48 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't run useradd command through php script in RHEL 7 mayank4aug Red Hat 7 04-20-2015 01:54 AM
[SOLVED] RHEL 5.3 Hangs when yum, rpm or df -h is run protos78 Red Hat 3 12-10-2009 04:32 AM
script/service/command executes during shutdown shipon_97 Linux - Newbie 1 08-30-2007 03:19 AM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM
unzip command with password in a script? captainhog Linux - General 1 03-29-2004 09:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration