Moodle

du needs to be GNU du

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.2, 1.9
  • Fix Version/s: 1.6.8, 1.7.6, 1.8.7, 1.9.3
  • Component/s: Administration
  • Labels:
    None
  • Environment:
    Solaris 10, sparc64, Mac OS X Server
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

Description

In Administration >> Configuration >> Variables >> Operating System is an entry for pathtodu. This should specify that GNU du is needed since du is called with --apparent-size, a GNUism. Otherwise, the error logs will contain lines similar to:
/usr/bin/du: illegal option – apparent-size
usage: du [-a] [-d] [-h|-k] [-r] [-o|-s] [-H|-L] [file ...]

The page in question is lang/en_utf8/admin.php

Activity

Hide
Nicolas Martignoni added a comment -

Confirming. Still present on 1.8+. On our Mac OS X server, the logs are full of these lines

IMHO, we shouldn't rely on specialities of Un*x variants.

Show
Nicolas Martignoni added a comment - Confirming. Still present on 1.8+. On our Mac OS X server, the logs are full of these lines IMHO, we shouldn't rely on specialities of Un*x variants.
Hide
Martin Dougiamas added a comment -

Does anyone have a better set of arguments to pass to du ?

Show
Martin Dougiamas added a comment - Does anyone have a better set of arguments to pass to du ?
Hide
Ken Wilson added a comment -

I'm not sure of any better arguments for *nix systems, and changing the arguments may cause problems for admins/users as they may suddenly see a change in the file sizes as reported by the get_directory_size function.

In any case, the GNU Win32 version of du does not have the --apparent-size option, so it's a GNUism only for Linux systems. For Windows systems, this is the only version of du available and the --apparent-size option breaks get_directory_size. Whatever the reason was for the inclusion of this option, I've attached a diff to check for Windows OS so that du works.

I've moved this up to major as it's a biggie for Windows users who are struggling with directories full of gigabytes of course materials .

Show
Ken Wilson added a comment - I'm not sure of any better arguments for *nix systems, and changing the arguments may cause problems for admins/users as they may suddenly see a change in the file sizes as reported by the get_directory_size function. In any case, the GNU Win32 version of du does not have the --apparent-size option, so it's a GNUism only for Linux systems. For Windows systems, this is the only version of du available and the --apparent-size option breaks get_directory_size. Whatever the reason was for the inclusion of this option, I've attached a diff to check for Windows OS so that du works. I've moved this up to major as it's a biggie for Windows users who are struggling with directories full of gigabytes of course materials .
Hide
Nicolas Martignoni added a comment -

See also this old discussion: http://moodle.org/mod/forum/discuss.php?d=30287

If this cannot be directly solved, suggesting the display of a warning.

Show
Nicolas Martignoni added a comment - See also this old discussion: http://moodle.org/mod/forum/discuss.php?d=30287 If this cannot be directly solved, suggesting the display of a warning.
Hide
Jeffrey Silverman added a comment -

Hi. Just weighing in with a "me too"

Running this thing ('thing" being Moodle on Solaris creates the same problem, as Solaris du does not have the --apparent_size option.

Not sure of a solution except to suggest that such system-specific code is not portable, but you all know that already.

Thanks!

Show
Jeffrey Silverman added a comment - Hi. Just weighing in with a "me too" Running this thing ('thing" being Moodle on Solaris creates the same problem, as Solaris du does not have the --apparent_size option. Not sure of a solution except to suggest that such system-specific code is not portable, but you all know that already. Thanks!
Hide
Jeffrey Silverman added a comment -

Oops, duh. The enviornment "Solaris" is already listed as part of the bug. Sorry! Still, would be nice to have this cleaned up.

Show
Jeffrey Silverman added a comment - Oops, duh. The enviornment "Solaris" is already listed as part of the bug. Sorry! Still, would be nice to have this cleaned up.
Hide
Howard Miller added a comment -

Another me too. Turned up on a pile of our sites using Solaris.

Show
Howard Miller added a comment - Another me too. Turned up on a pile of our sites using Solaris.
Hide
Martin Dougiamas added a comment -

OK, I've removed --apparent-size from everywhere. In some limited tests I did I could see no benefit in using it anyway!

Show
Martin Dougiamas added a comment - OK, I've removed --apparent-size from everywhere. In some limited tests I did I could see no benefit in using it anyway!
Hide
Nicolas Martignoni added a comment -

Closing, verified.

Show
Nicolas Martignoni added a comment - Closing, verified.

Dates

  • Created:
    Updated:
    Resolved: