Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6874789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:14:17+00:00 2026-05-27T04:14:17+00:00

First some code: Runtime runtime = Runtime.getRuntime(); String args[] = new String[2]; // args[0]

  • 0

First some code:

    Runtime runtime = Runtime.getRuntime();
    String args[] = new String[2];
//  args[0] = "/bin/bash";
//  args[1] = "-c";
//  args[2] = "/usr/bin/rpm2cpio "+archiveFile.getCanonicalPath()+" | /bin/cpio -idmv";
    args[0] = "/usr/bin/rpm2cpio";
    args[1] = archiveFile.getCanonicalPath();
    Process rpm2cpioProcess = runtime.exec(args, null, dir);
//  System.out.println("started rpm2cpio");

    String args2[] = new String[3];
    args2[0] = "/bin/cpio";
    args2[1] = "-idmu";
    args2[2] = "--quiet";
    Process cpioProcess = runtime.exec(args2, null, dir);
//  System.out.println("started cpio");

    InputStream fromRpm2cpio = rpm2cpioProcess.getInputStream();
    new ProcessInputStreamer(rpm2cpioProcess.getErrorStream());
    OutputStream fromCpio = cpioProcess.getOutputStream();
    new PipedStreamer(fromRpm2cpio, fromCpio);
    new ProcessInputStreamer(cpioProcess.getErrorStream());
//  System.out.println("pipe created");
    while(cpioProcess!=null && fromRpm2cpio!=null) {
        boolean doSleep = true;
//      System.out.println("waking up");
        if (cpioProcess!=null) {
            try {
                if (cpioProcess.exitValue()==0) {
                    cpioProcess = null;
                    doSleep = false;
                }
            } catch(IllegalThreadStateException e) {
            }
        }
        if (rpm2cpioProcess!=null) {
            try {
                if (rpm2cpioProcess.exitValue()==0) {
                    rpm2cpioProcess = null;
                    doSleep = false;
                }
            } catch(IllegalThreadStateException e) {
            }
        }
        if (doSleep) {
            Thread.sleep(30);
        }
//      System.out.println("still running");
    }

I’m trying to extract the content of an rpm archive. This code works fine after multiple modifications. My first attempt was to execute the next code through Java:

/bin/bash -c '/usr/bin/rpm2cpio <archive-file> | /bin/cpio -idmv'

Which worked fine the first time I ran it (you can see it in the code commented above). The second time I ran the code it got blocked since the extracted files already existed. So I thought maybe it has to do with the piping and thus split the call into two separate processes. This didn’t help much either. So I then modified the arguments of the /bin/cpio from ‘-idmv’ to ‘-idmu –quiet’ and now it works. Unfortunately the -u option overwrites existing files ‘unconditionally’ which is not really needed. My question is why does it block with -idmv and why doesn’t it block with -idmu ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:14:18+00:00Added an answer on May 27, 2026 at 4:14 am

    I’d guess that your ProcessInputStreamer and/or PipedStreamer implement Runnable or extent Thread and you’re not running them anywhere.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have code like: ms = New IO.MemoryStream bin = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bin.Serialize(ms, largeGraphOfObjects)
I'm trying to write some code to remove the first N characters in a
I'm trying to write some code to Hide columns if the first 3 characters
I've written some code for a button action. First I'm creating a button UI
First, to make my job explaining a bit easier, here's some of my code:
I'm reading input in a C++ program. First some integers, then a string. When
The code below describes a Java situation. I used some psudocode in the getRuntime().exec
Let's say I have some code like this in AS3 for(...) thing = new
I am trying to write some c# code to start a browser using Process.Start(app,args);
First some background: VB.NET 2005 Application that accesses a MS-SQL back-end, using multiple Web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.