Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update icewind/smb to 3.5.4 #32632

Merged
merged 2 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/files_external/3rdparty/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

// autoload.php @generated by Composer

if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit98fe9b281934250b3a93f69a5ce843b3::getLoader();
2 changes: 1 addition & 1 deletion apps/files_external/3rdparty/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
},
"require": {
"icewind/streams": "0.7.4",
"icewind/smb": "3.5.2"
"icewind/smb": "3.5.4"
}
}
16 changes: 8 additions & 8 deletions apps/files_external/3rdparty/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions apps/files_external/3rdparty/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_classmap.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = $vendorDir;

return array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = $vendorDir;

return array(
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/3rdparty/composer/autoload_psr4.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$vendorDir = dirname(__DIR__);
$baseDir = $vendorDir;

return array(
Expand Down
15 changes: 3 additions & 12 deletions apps/files_external/3rdparty/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,11 @@ public static function getLoader()
require __DIR__ . '/platform_check.php';

spl_autoload_register(array('ComposerAutoloaderInit98fe9b281934250b3a93f69a5ce843b3', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit98fe9b281934250b3a93f69a5ce843b3', 'loadClassLoader'));

$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit98fe9b281934250b3a93f69a5ce843b3::getInitializer($loader));

$loader->setClassMapAuthoritative(true);
$loader->register(true);
Expand Down
14 changes: 7 additions & 7 deletions apps/files_external/3rdparty/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"packages": [
{
"name": "icewind/smb",
"version": "v3.5.2",
"version_normalized": "3.5.2.0",
"version": "v3.5.4",
"version_normalized": "3.5.4.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/SMB.git",
"reference": "0a425bd21acf7ae112b135dca34640e1b1a825c3"
"reference": "76995aa11c14e39bccd0f2370ed63b2f8f623a6d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/0a425bd21acf7ae112b135dca34640e1b1a825c3",
"reference": "0a425bd21acf7ae112b135dca34640e1b1a825c3",
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/76995aa11c14e39bccd0f2370ed63b2f8f623a6d",
"reference": "76995aa11c14e39bccd0f2370ed63b2f8f623a6d",
"shasum": ""
},
"require": {
Expand All @@ -25,7 +25,7 @@
"phpunit/phpunit": "^8.5|^9.3.8",
"psalm/phar": "^4.3"
},
"time": "2022-01-20T14:51:51+00:00",
"time": "2022-05-30T15:18:19+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand All @@ -46,7 +46,7 @@
"description": "php wrapper for smbclient and libsmbclient-php",
"support": {
"issues": "https://github.com/icewind1991/SMB/issues",
"source": "https://github.com/icewind1991/SMB/tree/v3.5.2"
"source": "https://github.com/icewind1991/SMB/tree/v3.5.4"
},
"install-path": "../icewind/smb"
},
Expand Down
10 changes: 5 additions & 5 deletions apps/files_external/3rdparty/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
'reference' => '0bed61f949bc7a8c69cd154919e78b704e28c99e',
'reference' => '15d43dcc6226b92c0d51d643ef8c5ab1339cae48',
'name' => 'files_external/3rdparty',
'dev' => true,
),
Expand All @@ -16,16 +16,16 @@
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
'reference' => '0bed61f949bc7a8c69cd154919e78b704e28c99e',
'reference' => '15d43dcc6226b92c0d51d643ef8c5ab1339cae48',
'dev_requirement' => false,
),
'icewind/smb' => array(
'pretty_version' => 'v3.5.2',
'version' => '3.5.2.0',
'pretty_version' => 'v3.5.4',
'version' => '3.5.4.0',
'type' => 'library',
'install_path' => __DIR__ . '/../icewind/smb',
'aliases' => array(),
'reference' => '0a425bd21acf7ae112b135dca34640e1b1a825c3',
'reference' => '76995aa11c14e39bccd0f2370ed63b2f8f623a6d',
'dev_requirement' => false,
),
'icewind/streams' => array(
Expand Down
9 changes: 8 additions & 1 deletion apps/files_external/3rdparty/icewind/smb/src/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ protected function getBinaryPath(string $binary): ?string {
$result = null;
$output = [];
exec("which $binary 2>&1", $output, $result);
$this->paths[$binary] = $result === 0 && isset($output[0]) ? (string)$output[0] : null;

if ($result === 0 && isset($output[0])) {
$this->paths[$binary] = (string)$output[0];
} else if (is_executable("/usr/bin/$binary")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else if (is_executable("/usr/bin/$binary")) {
} elseif (is_executable("/usr/bin/$binary")) {

Not blocking but should still be fixed upstream

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@come-nc can you submit a PR upstream ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this->paths[$binary] = "/usr/bin/$binary";
} else {
$this->paths[$binary] = null;
}
}
return $this->paths[$binary];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function unknownError($promptLine = '') {
} else {
$error = $this->readError(); // maybe something on stderr
if ($error) {
throw new ConnectException('Unknown error (' . $error . ')');
throw new ConnectException('Unknown error (stderr: ' . $error . ')');
} else {
throw new ConnectException('Unknown error');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ public function parseStat(array $output): array {
public function parseDir(array $output, string $basePath, callable $aclCallback): array {
//last line is used space
array_pop($output);
$regex = '/^\s*(.*?)\s\s\s\s+(?:([NDHARS]*)\s+)?([0-9]+)\s+(.*)$/';
$regex = '/^\s*(.*?)\s\s\s\s+(?:([NDHARSCndharsc]*)\s+)?([0-9]+)\s+(.*)$/';
//2 spaces, filename, optional type, size, date
$content = [];
foreach ($output as $line) {
if (preg_match($regex, $line, $matches)) {
list(, $name, $mode, $size, $time) = $matches;
if ($name !== '.' and $name !== '..') {
$mode = $this->parseMode($mode);
$mode = $this->parseMode(strtoupper($mode));
$time = strtotime($time . ' ' . $this->timeZone);
$path = $basePath . '/' . $name;
$content[] = new FileInfo($path, $name, (int)$size, $time, $mode, function () use ($aclCallback, $path): array {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public function connect(): void {
'CLI_NO_READLINE' => 1, // Not all distros build smbclient with readline, disable it to get consistent behaviour
'LC_ALL' => Server::LOCALE,
'LANG' => Server::LOCALE,
'COLUMNS' => 8192 // prevent smbclient from line-wrapping it's output
'COLUMNS' => 8192, // prevent smbclient from line-wrapping it's output
'TZ' => 'UTC',
]);
$this->process = proc_open($this->command, $descriptorSpec, $this->pipes, '/', $env);
if (!$this->isValid()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function listShares(): array {
throw new ConnectionException((string)$connection->readLine());
}

$parser = new Parser($this->timezoneProvider->get($this->host));
$parser = new Parser('UTC');

$output = $connection->readAll();
if (isset($output[0])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function __construct(IServer $server, string $name, ISystem $system) {
$this->server = $server;
$this->name = $name;
$this->system = $system;
$this->parser = new Parser($server->getTimeZone());
$this->parser = new Parser('UTC');
}

private function getAuthFileArgument(): string {
Expand Down