mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] ptxdist compile redirects stderr to stdout
@ 2016-11-30  8:46 Jon Ringle
  2016-12-01 10:29 ` Michael Olbrich
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Ringle @ 2016-11-30  8:46 UTC (permalink / raw)
  To: ptxdist; +Cc: jonringle

I discovered after updating to a new version of ptxdist that all of my    
compile output including errors/warnings are now all going to stdout
instead of having the errors/warning going to stderr.

This is causing some problem when I use qtcreator as my IDE because
qtcreator will only filter stderr for errors/warnings to put into the
Issues tab, where one can simply click on the error/warning and be taken  
right to the source line where the error/warning is found. 
 
I create a small program to demonstrate the problem:
$ cat local_src/testprog/testprog.c
#include <stdio.h>
#include <stdlib.h>

#error An error here
int main(int argc, char *argv[])
{
        printf("Hello World, I'm testprog!\n");

        exit(EXIT_SUCCESS);
}

$ ptxdist-2016.10.0 --force targetinstall testprog >/dev/null
make: ***
[/home/jringle-admin/code/gpec/ec1k-rootfs/platform-EC1C/state/testprog.compile]
Error 2

$ ptxdist-2015.08.0 --force targetinstall testprog >/dev/null
testprog.c:4:2: error: #error An error here
 #error An error here
  ^
make[1]: *** [testprog] Error 1
make: ***
[/home/jringle-admin/code/gpec/ec1k-rootfs/platform-EC1C/state/testprog.compile]
Error 2

I found that this is being caused by commit
30b9267e35eea1c2edb4da0231a428bfa25b6766

Is there a way that the stderr to stdout redirect could be implemented    
conditionally so that I can still have stderr segregated if I want to?

Regards,
Jon

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] ptxdist compile redirects stderr to stdout
  2016-11-30  8:46 [ptxdist] ptxdist compile redirects stderr to stdout Jon Ringle
@ 2016-12-01 10:29 ` Michael Olbrich
  2016-12-02 17:25   ` Jon Ringle
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Olbrich @ 2016-12-01 10:29 UTC (permalink / raw)
  To: ptxdist

Hi,

On Wed, Nov 30, 2016 at 03:46:14AM -0500, Jon Ringle wrote:
> I discovered after updating to a new version of ptxdist that all of my    
> compile output including errors/warnings are now all going to stdout
> instead of having the errors/warning going to stderr.
> 
> This is causing some problem when I use qtcreator as my IDE because
> qtcreator will only filter stderr for errors/warnings to put into the
> Issues tab, where one can simply click on the error/warning and be taken  
> right to the source line where the error/warning is found. 
>  
> I create a small program to demonstrate the problem:
> $ cat local_src/testprog/testprog.c
> #include <stdio.h>
> #include <stdlib.h>
> 
> #error An error here
> int main(int argc, char *argv[])
> {
>         printf("Hello World, I'm testprog!\n");
> 
>         exit(EXIT_SUCCESS);
> }
> 
> $ ptxdist-2016.10.0 --force targetinstall testprog >/dev/null
> make: ***
> [/home/jringle-admin/code/gpec/ec1k-rootfs/platform-EC1C/state/testprog.compile]
> Error 2
> 
> $ ptxdist-2015.08.0 --force targetinstall testprog >/dev/null
> testprog.c:4:2: error: #error An error here
>  #error An error here
>   ^
> make[1]: *** [testprog] Error 1
> make: ***
> [/home/jringle-admin/code/gpec/ec1k-rootfs/platform-EC1C/state/testprog.compile]
> Error 2
> 
> I found that this is being caused by commit
> 30b9267e35eea1c2edb4da0231a428bfa25b6766
> 
> Is there a way that the stderr to stdout redirect could be implemented    
> conditionally so that I can still have stderr segregated if I want to?

Yes. It's really only necessary if output synchronization is enabled. So,
we could set some variable in setup_parallel() to '1' or '2' depending on
PTXDIST_OUTPUT_SYNC and then use it instead of '2>&1'.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] ptxdist compile redirects stderr to stdout
  2016-12-01 10:29 ` Michael Olbrich
@ 2016-12-02 17:25   ` Jon Ringle
  2016-12-05  9:03     ` Michael Olbrich
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Ringle @ 2016-12-02 17:25 UTC (permalink / raw)
  To: ptxdist, ptxdist



On Thu, 1 Dec 2016, Michael Olbrich wrote:

> Hi,
> 
> On Wed, Nov 30, 2016 at 03:46:14AM -0500, Jon Ringle wrote:
> > I found that this is being caused by commit
> > 30b9267e35eea1c2edb4da0231a428bfa25b6766
> > 
> > Is there a way that the stderr to stdout redirect could be implemented    
> > conditionally so that I can still have stderr segregated if I want to?
> 
> Yes. It's really only necessary if output synchronization is enabled. So,
> we could set some variable in setup_parallel() to '1' or '2' depending on
> PTXDIST_OUTPUT_SYNC and then use it instead of '2>&1'.

I did some experimenting with this, and when I use a variable to hold 
"2>&1", it works fine for the *) case, but for the python*) case where the 
ptxd_eval is surrounded by ( ), bash chokes.

Here's what I was trying:
ptxd_make_world_compile() {

    output_redirect="2>&1";

    ptxd_make_world_init &&

    if [ -z "${pkg_build_dir}" ]; then
        # no build dir -> assume the package has nothing to build.
        return
    fi &&
    case "${pkg_conf_tool}" in
        python*)
        (
        ptxd_eval \
            cd "${pkg_build_dir}" '&&' \
            "${pkg_path}" \
            "${pkg_env}" \
            "${pkg_make_env}" \
            "${ptx_build_python}" \
            setup.py \
            "${pkg_make_opt}"
        ) ${output_redirect}
        ;;
        *)
        ptxd_eval \
            "${pkg_path}" \
            "${pkg_env}" \
            "${pkg_make_env}" \
            "${MAKE}" -C "${pkg_build_dir}" \
            "${pkg_make_opt}" \
            "${pkg_make_par}" ${output_redirect}
        ;;
    esac
}

$ ~/git/ptxdist/bin/ptxdist --force compile testprog >/dev/null
/home/jringle-admin/git/ptxdist/scripts/lib/ptxd_make_world_compile.sh: 
line 35: syntax error near unexpected token `${output_redirect}'
/home/jringle-admin/git/ptxdist/scripts/lib/ptxd_make_world_compile.sh: 
line 35: `      ) ${output_redirect}'
ptxdist: error: failed to source lib: 
/home/jringle-admin/git/ptxdist/scripts/lib/ptxd_make_world_compile.sh


If I remove the variable redirect from the offending line and leave the 
variable redirect in the *) case, bash is fine with it and it does what is 
expected.

-Jon

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] ptxdist compile redirects stderr to stdout
  2016-12-02 17:25   ` Jon Ringle
@ 2016-12-05  9:03     ` Michael Olbrich
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Olbrich @ 2016-12-05  9:03 UTC (permalink / raw)
  To: ptxdist

Hi,

On Fri, Dec 02, 2016 at 12:25:01PM -0500, Jon Ringle wrote:
> On Thu, 1 Dec 2016, Michael Olbrich wrote:
> > On Wed, Nov 30, 2016 at 03:46:14AM -0500, Jon Ringle wrote:
> > > I found that this is being caused by commit
> > > 30b9267e35eea1c2edb4da0231a428bfa25b6766
> > > 
> > > Is there a way that the stderr to stdout redirect could be implemented    
> > > conditionally so that I can still have stderr segregated if I want to?
> > 
> > Yes. It's really only necessary if output synchronization is enabled. So,
> > we could set some variable in setup_parallel() to '1' or '2' depending on
> > PTXDIST_OUTPUT_SYNC and then use it instead of '2>&1'.
> 
> I did some experimenting with this, and when I use a variable to hold 
> "2>&1", it works fine for the *) case, but for the python*) case where the 
> ptxd_eval is surrounded by ( ), bash chokes.
> 
> Here's what I was trying:
> ptxd_make_world_compile() {
> 
>     output_redirect="2>&1";
> 
>     ptxd_make_world_init &&
> 
>     if [ -z "${pkg_build_dir}" ]; then
>         # no build dir -> assume the package has nothing to build.
>         return
>     fi &&
>     case "${pkg_conf_tool}" in
>         python*)
>         (
>         ptxd_eval \
>             cd "${pkg_build_dir}" '&&' \
>             "${pkg_path}" \
>             "${pkg_env}" \
>             "${pkg_make_env}" \
>             "${ptx_build_python}" \
>             setup.py \
>             "${pkg_make_opt}"
>         ) ${output_redirect}
>         ;;
>         *)
>         ptxd_eval \
>             "${pkg_path}" \
>             "${pkg_env}" \
>             "${pkg_make_env}" \
>             "${MAKE}" -C "${pkg_build_dir}" \
>             "${pkg_make_opt}" \
>             "${pkg_make_par}" ${output_redirect}
>         ;;
>     esac
> }
> 
> $ ~/git/ptxdist/bin/ptxdist --force compile testprog >/dev/null
> /home/jringle-admin/git/ptxdist/scripts/lib/ptxd_make_world_compile.sh: 
> line 35: syntax error near unexpected token `${output_redirect}'
> /home/jringle-admin/git/ptxdist/scripts/lib/ptxd_make_world_compile.sh: 
> line 35: `      ) ${output_redirect}'
> ptxdist: error: failed to source lib: 
> /home/jringle-admin/git/ptxdist/scripts/lib/ptxd_make_world_compile.sh
> 
> 
> If I remove the variable redirect from the offending line and leave the 
> variable redirect in the *) case, bash is fine with it and it does what is 
> expected.

It would work if you move it inside the brackets. But I think it would be
better to just have one redirect after the 'esac'.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-05  9:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-30  8:46 [ptxdist] ptxdist compile redirects stderr to stdout Jon Ringle
2016-12-01 10:29 ` Michael Olbrich
2016-12-02 17:25   ` Jon Ringle
2016-12-05  9:03     ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox