Skip navigation
This discussion is archived

at is broken File is in wrong format (Panther)

1220 Views 10 Replies Latest reply: Nov 26, 2007 5:50 PM by jarik RSS
jarik Level 4 Level 4 (1,005 points)
Currently Being Moderated
Sep 9, 2006 2:22 PM
I am not sure when it happened, but my at jobs fail now. In system.log it says

Sep 9 17:10:00 hostname atrun[16868]: File a0000c012673f6 is in wrong format - aborting

I enter that job as

$ echo touch /tmp/test.stamp | at now + 5 minutes

(Needless to say the file was not created).

What's going on? Ideas?

PowerBook G4 15" Aluminum, Mac OS X (10.3.9), PowerBook G4 12"
  • Roger Smith3 Level 6 Level 6 (13,475 points)
    Currently Being Moderated
    Sep 9, 2006 4:06 PM (in response to jarik)
    Your command to invoke the at job, at most, sends a line feed as the at job, so you're getting a null job. It would probably be easier to set the at job interactively:

    at now + 5 minutes
    touch /tmp/test.stamp

    But if you want to use that piped command:

    echo "touch /tmp/test.stamp" | at now + 5 minutes

    Since the command prompt has a dollar sign, the user isn't root. There may be permission issues on either /tmp or /tmp/test.stamp that don't allow the command to execute. Also at can be enabled/disabled on a per user basis so the user may not be allowed to run at jobs.

    XServer, Mac OS X (10.4.3), XRAID, Xasperated
  • Michael Bradshaw Level 5 Level 5 (4,135 points)
    Currently Being Moderated
    Sep 10, 2006 12:35 PM (in response to jarik)

    cron is very different than a normal log in.

    I would suggest you make a script in /usr/local/bin (or elsewhere) and simply call that script in cron. That way you can be sure various user env variables are set in that script as needed... ($PATH would be the first var I check

    Let's dig into #5...

    What does your mac have to correspond? (sorry I'm no longer at 10.3 - so the date and md5 checksum probably are different for you...)

    <pre>mac:~ me$ which at
    mac:~ me$ file /usr/bin/at
    /usr/bin/at: setuid Mach-O executable ppc
    mac:~ me$ ls -l /usr/bin/at
    -r-sr-xr-x 4 root wheel 34576 Mar 20 2005 /usr/bin/at*
    mac:~ me$ md5 /usr/bin/at
    MD5 (/usr/bin/at) = fee2b14836357a9fcbd09b56fd1e5504</pre>
  • Michael Bradshaw Level 5 Level 5 (4,135 points)
    Currently Being Moderated
    Sep 10, 2006 3:38 PM (in response to jarik)

    Good work!

    I could see MD5 being different depending on all the software on the mac. Have you forced rebuilding prebinding on these?

    To get things to work - I'm not against moving binaries from system to system Can't really hurt much if at is broken.

    P.S. The part of the path that made me mention it was the naked "at" after the pipe - I see now that you have that pretty much under control
  • David Kerns1 Calculating status...
    Currently Being Moderated
    Sep 13, 2006 8:42 AM (in response to jarik)
    OK - I found the source code for atrun at, this snippet is the part
    where it aborts

    snprintf(fmt, sizeof(fmt),
    /bin/sh\n# atrun uid=%%ld gid=%%ld\n# mail %%%ds
    , &nuid, &ngid, mailbuf, &send_mail) != 4) {
    syslog(LOG_ERR,"File %s is in wrong format -
    - aborting", filename);
    you look at my previous message, you can see the
    first three lines is what is being sscanned. Does
    anyone know what the format "%%%ds" is for?

    I am not sure if that source is for Panther though.


    "%%%ds" is getting processed by (sn)printf before it's being used by the (f)scanf ... so the format the scanf sees is "%Xs" where X is an integer equal to the length of the loginname.

    so all together.... (I don't know the definition of LOGNAMESIZE, so let's assume 20)

    #define LOGNAMESIZE 20

    // %% in printf is how to esacape a %
    // after the snprintf
    fmt = "#!/bin/sh\n# atrun uid=%ld gid=%ld\n# mail %20s %d";

    // you should get enough info by (temporarily) changing the section to this:

    { int n; // add {} for local temps
    char tb[100];
    snprintf(fmt, sizeof(fmt),
    "#!/bin/sh\n# atrun uid=%%ld gid=%%ld\n# mail %%%ds %%d",
    fscanf(stream, "%50s", tb);
    n=sscanf(tb, fmt, &nuid, &ngid, mailbuf, &send_mail)
    syslog(LOG_ERR,"at file in wrong format - aborting n=%d |%s|", n, tb);

    // note: I made it always fail, you're debugging...

    PowerBook G4   Mac OS X (10.4)  


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.