I'm seeing some weird behavior. Got this line: my @stats = stat($f);

$f is the path to a file sitting on an amazon s3 bucket. I am using s3fs to mount the bucket on my instance and the path to the file looks like a normal path, something like: /backups/backups_db/some_dir/file. The backups_db is a symlink to /s3bucket/backups_db At any rate, @stats contains values from the stat() function above but in totally random order. Here's a dump of three different files:

[DEBUG] Rex.CLI: 206 $VAR1 = [ 'gid', 1000, 'size', 325342, 'mode', '0644', 'mtime', 1623769844, 'uid', 1000, 'atime', 0 ]; [DEBUG] Rex.CLI: 206 $VAR1 = [ 'uid', 1000, 'size', 325316, 'atime', 0, 'gid', 1000, 'mode', '0644', 'mtime', 1623771735 ]; [DEBUG] Rex.CLI: 206 $VAR1 = [ 'gid', 1000, 'mtime', 1623772143, 'mode', '0644', 'atime', 0, 'uid', 1000, 'size', 325346 ];

I'm not sure if I'm just being an idiot on how to use the stat() function or if the stat() function does not work properly on a file on an s3 bucket using s3fs. If it's the latter, can this be fixed?

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks


In reply to stat() returning values in random order for files on s3 bucket? (SOLVED) by nysus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.