James Server
  1. James Server
  2. JAMES-663

sendmail.py crashes on line "from_addr = os.environ['USER'] + '@' + socket.getfqdn()"

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3.0
    • Fix Version/s: 2.3.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Debian Linux, Python 2.3.5, "Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)"

      Description

      This line in sendmail.py:

      from_addr = os.environ['USER'] + '@' + socket.getfqdn()

      causes my mail-delivery to crash:

      <--snip-->

      Traceback (most recent call last):
      File "/usr/sbin/sendmail", line 126, in ?
      main(sys.argv)
      File "/usr/sbin/sendmail", line 77, in main
      from_addr = os.environ['USER'] + '@' + socket.getfqdn()
      File "/usr/lib/python2.3/UserDict.py", line 19, in _getitem_
      def _getitem_(self, key): return self.data[key]
      KeyError: 'USER'

      </--snip-->

      I think it's an permission-thing, but didn't went any further.

      I just changed it to

      from_addr = "postmaster@localhost"

      (since the sender is pased by "-f") and now it works.

        Activity

        Hide
        Noel J. Bergman added a comment -

        Run

        $ export

        and see if you have USER defined in your environment. Alternatively, you can use LOGNAME instead.

        debian linux is insufficiently descriptive, lacking a version number. I've tested on RH8, RHEL4, Ubuntu 5.10 and Ubuntu 6.06.

        Show
        Noel J. Bergman added a comment - Run $ export and see if you have USER defined in your environment. Alternatively, you can use LOGNAME instead. debian linux is insufficiently descriptive, lacking a version number. I've tested on RH8, RHEL4, Ubuntu 5.10 and Ubuntu 6.06.
        Hide
        Stephan Sann added a comment -

        Hello Noel,

        > Run
        >
        > $ export
        >
        > and see if you have USER defined in your environment. Alternatively, you can use LOGNAME instead.

        When I run "export" on the shell, I can see that both USER and LOGNAME are defined. But I think this information isn't very helpfull, since many people (so am I -> JAMES-662) call the sendmail-wrapper from PHP (or any other CGI-script) within the webserver. The enviroment here may be completely different (in my case (and maybe in many others) USER and LOGNAME are not set in the webserver-enviroment).

        IMHO your script a least should make arrangements for the case that USER isn't set (don't know if Python has an exception-handling - I'm no Python-programmer) and set a default-value instead in case of emergency

        > debian linux is insufficiently descriptive, lacking a version number.

        Debian 3.0 (a.k.a woody)

        > I've tested on RH8, RHEL4, Ubuntu 5.10 and Ubuntu 6.06.

        Let me guess: On the shell?

        Show
        Stephan Sann added a comment - Hello Noel, > Run > > $ export > > and see if you have USER defined in your environment. Alternatively, you can use LOGNAME instead. When I run "export" on the shell, I can see that both USER and LOGNAME are defined. But I think this information isn't very helpfull, since many people (so am I -> JAMES-662 ) call the sendmail-wrapper from PHP (or any other CGI-script) within the webserver. The enviroment here may be completely different (in my case (and maybe in many others) USER and LOGNAME are not set in the webserver-enviroment). IMHO your script a least should make arrangements for the case that USER isn't set (don't know if Python has an exception-handling - I'm no Python-programmer) and set a default-value instead in case of emergency > debian linux is insufficiently descriptive, lacking a version number. Debian 3.0 (a.k.a woody) > I've tested on RH8, RHEL4, Ubuntu 5.10 and Ubuntu 6.06. Let me guess: On the shell?
        Hide
        Norman Maurer added a comment -

        Fixed in trunk. Should be backported to 2.3.1

        Show
        Norman Maurer added a comment - Fixed in trunk. Should be backported to 2.3.1
        Hide
        Danny Angus added a comment -

        Closing issue fixed in released version.

        Show
        Danny Angus added a comment - Closing issue fixed in released version.

          People

          • Assignee:
            Norman Maurer
            Reporter:
            Stephan Sann
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development