Giter Site home page Giter Site logo

Comments (13)

okbob avatar okbob commented on May 22, 2024

It is related to this code:

    if (freopen("/dev/tty", "rw", stdin) == NULL)
    {
        fprintf(stderr, "cannot to reopen stdin: %s\n", strerror(errno));
        exit(1);
    }

I am changing to switch from stdin (because it is used in pipe, and it is a change to interactive mode). It looks so command executed in this mode has not a access to tty. Now I have not idea, how it should be fixed.

from pspg.

okbob avatar okbob commented on May 22, 2024

I am not sure if it is fixed correctly, but it looks like good workaround. Please, test it.

from pspg.

bjne avatar bjne commented on May 22, 2024

Seems it is still a problem, this time with permission:

cannot to reopen stdin: Permission denied

from pspg.

okbob avatar okbob commented on May 22, 2024

isn't is selinux issue? Now I cannot to reproduce it.

from pspg.

bjne avatar bjne commented on May 22, 2024

No selinux

root@roadwarrior:~# echo 'testing 1-2-3'| su postgres -c "pspg"
cannot to reopen stdin: Permission denied

from pspg.

okbob avatar okbob commented on May 22, 2024

I can reproduce it :-(

from pspg.

okbob avatar okbob commented on May 22, 2024

I found a workaround, but probably not sure how much is secure or unsecure. You can run tty command instead pspg and you get number of pts device. Then you can allow rights:

[pavel@nemesis pspg-master]$ chmod a+rw /dev/pts/3
[pavel@nemesis pspg-master]$ su - postgres -c "PSQL_PAGER='/usr/local/bin/pspg -s 0' /usr/local/pgsql/bin/psql"

This is working

from pspg.

bjne avatar bjne commented on May 22, 2024

wow-wow-wow, that is a horrible workaround. The problem is not that I am not able to make
use of pspg, but I think it should work the way I am executing it as well, I think you could accomplish
whatever you want with reopening terminal another way, that will also work with su user -c "pspg"

from pspg.

okbob avatar okbob commented on May 22, 2024

yes, it is horrible workaround and doesn't work in fresh terminal. I have minimal knowledges about terminals, and I miss some about usage of ptsx

from pspg.

okbob avatar okbob commented on May 22, 2024

su user -c "pspg" is not problem (not now, because the work with streams are ugly in pspg). In this case I have assigned terminal device in good mode. But when it is executed as nested command from psql, then I have not assigned stdin for interactive mode.

from pspg.

okbob avatar okbob commented on May 22, 2024

@bjne - please, can you check cda02ea ?

from pspg.

bjne avatar bjne commented on May 22, 2024

This seems to work, great! Thanks for your attention to fixing!

from pspg.

okbob avatar okbob commented on May 22, 2024

super

from pspg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.