<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - systemctl error messages contain no context"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=87249">87249</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>systemctl error messages contain no context
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>morten.hustveit@gmail.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Observed behavior:

[bob@a00:~]$ sudo systemctl enable /foo/bar.service
Failed to execute operation: Invalid argument

Expected behvaior:

[bob@a00:~]$ sudo systemctl enable /foo/bar.service
Unable to create symbolic link /etc/systemd/system/bar.service: target already
exists

Details:

It seems that the systemd code generally passes error information as a single
numeric code, even across contexts where the caller cannot know what the error
code applies to.  This problem is further exacerbated by systemctl itself not
doing any work; attempting to run systemctl under strace will not reveal
additional context.

I would suggest making a per-thread error description string that takes
precedence over errno if set, maybe something like this:
<a href="https://gist.github.com/mortehu/df056c55958723b6836e">https://gist.github.com/mortehu/df056c55958723b6836e</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>