akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
954 stars 514 forks source link

[v1.6.3] Upgrade "league/flysystem-sftp" version to 1.0.10 #5129

Closed mathewrapid closed 7 years ago

mathewrapid commented 7 years ago

I'm reporting a Bug

akeneo-pim-system-info_2016-10-18_11-17.txt

Added a new FlySystem adapter and filesystem

# config.yml
oneup_flysystem:
    adapters:
        magento_adapter:
            sftp:
                host: localhost
                port: ~
                username: test
                password: test
                root: ~
                timeout: ~
                privateKey: ~
                permPrivate: ~
                permPublic: ~
    filesystems:
        magento:
            adapter: magento_adapter
            mount: magento
            plugins:
                - oneup_flysystem.plugin.list_files

When using this filesystem for storing data an exception is thrown:

batch.ERROR: Encountered fatal error executing job ["exception",[{"class":"Symfony\Component\Debug\Exception\ContextErrorException","message":"Warning: unpack(): Type N: not enough input, need 4, have 1","messageParameters":[],"code":0,"trace":"#0 [internal function]: Symfony\Component\Debug\ErrorHandler->handleError(2, 'unpack(): Type ...', '/vagrant/vendor...', 2826, Array)
#1 /vagrant/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php(2826): unpack('Nlength', '\x00')
#2 /vagrant/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php(2771): Net_SSH2->_filter('P\x00\x00\x00\x17hostkeys-0...')
#3 /vagrant/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php(2974): Net_SSH2->_get_binary_packet()
#4 /vagrant/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php(441): Net_SSH2->_get_channel_packet(256)
#5 /vagrant/vendor/league/flysystem-sftp/src/SftpAdapter.php(127): Net_SFTP->login('test', 'test')
#6 /vagrant/vendor/league/flysystem-sftp/src/SftpAdapter.php(116): League\Flysystem\Sftp\SftpAdapter->login()
#7 /vagrant/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php(572): League\Flysystem\Sftp\SftpAdapter->connect()
#8 /vagrant/vendor/league/flysystem-sftp/src/SftpAdapter.php(391): League\Flysystem\Adapter\AbstractFtpAdapter->getConnection()
#9 /vagrant/vendor/league/flysystem-sftp/src/SftpAdapter.php(383): League\Flysystem\Sftp\SftpAdapter->getMetadata('attribute_expor...')
#10 /vagrant/vendor/league/flysystem/src/Filesystem.php(54): League\Flysystem\Sftp\SftpAdapter->has('attribute_expor...')
#11 /vagrant/vendor/league/flysystem/src/Filesystem.php(95): League\Flysystem\Filesystem->has('attribute_expor...')
#12 /vagrant/vendor/akeneo/pim-community-dev/src/Pim/Component/Connector/Archiver/FileWriterArchiver.php(124): League\Flysystem\Filesystem->put('attribute_expor...', 'code;label-sv_S...')
#13 /vagrant/vendor/akeneo/pim-community-dev/src/Pim/Component/Connector/Archiver/FileWriterArchiver.php(52): Pim\Component\Connector\Archiver\FileWriterArchiver->doArchive(Object(Akeneo\Component\Batch\Model\JobExecution), Array)
#14 /vagrant/vendor/akeneo/pim-community-dev/src/Pim/Bundle/ConnectorBundle/EventListener/JobExecutionArchivist.php(66): Pim\Component\Connector\Archiver\FileWriterArchiver->archive(Object(Akeneo\Component\Batch\Model\JobExecution))
#15 [internal function]: Pim\Bundle\ConnectorBundle\EventListener\JobExecutionArchivist->beforeStatusUpgrade(Object(Akeneo\Component\Batch\Event\JobExecutionEvent), 'akeneo_batch.be...', Object(Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher))
#16 /vagrant/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php(61): call_user_func(Array, Object(Akeneo\Component\Batch\Event\JobExecutionEvent), 'akeneo_batch.be...', Object(Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher))
#17 [internal function]: Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(Object(Akeneo\Component\Batch\Event\JobExecutionEvent), 'akeneo_batch.be...', Object(Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher))
#18 /vagrant/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(164): call_user_func(Object(Symfony\Component\EventDispatcher\Debug\WrappedListener), Object(Akeneo\Component\Batch\Event\JobExecutionEvent), 'akeneo_batch.be...', Object(Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher))
#19 /vagrant/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(53): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'akeneo_batch.be...', Object(Akeneo\Component\Batch\Event\JobExecutionEvent))
#20 /vagrant/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php(167): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('akeneo_batch.be...', Object(Akeneo\Component\Batch\Event\JobExecutionEvent))
#21 /vagrant/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php(124): Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('akeneo_batch.be...', Object(Akeneo\Component\Batch\Event\JobExecutionEvent))
#22 /vagrant/vendor/akeneo/pim-community-dev/src/Akeneo/Component/Batch/Job/Job.php(301): Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch('akeneo_batch.be...', Object(Akeneo\Component\Batch\Event\JobExecutionEvent))
#23 /vagrant/vendor/akeneo/pim-community-dev/src/Akeneo/Component/Batch/Job/Job.php(290): Akeneo\Component\Batch\Job\Job->dispatch('akeneo_batch.be...', Object(Akeneo\Component\Batch\Event\JobExecutionEvent))
#24 /vagrant/vendor/akeneo/pim-community-dev/src/Akeneo/Component/Batch/Job/Job.php(238): Akeneo\Component\Batch\Job\Job->dispatchJobExecutionEvent('akeneo_batch.be...', Object(Akeneo\Component\Batch\Model\JobExecution))
#25 /vagrant/vendor/akeneo/pim-community-dev/src/Akeneo/Component/Batch/Job/Job.php(161): Akeneo\Component\Batch\Job\Job->doExecute(Object(Akeneo\Component\Batch\Model\JobExecution))
#26 /vagrant/vendor/akeneo/pim-community-dev/src/Akeneo/Bundle/BatchBundle/Command/BatchCommand.php(162): Akeneo\Component\Batch\Job\Job->execute(Object(Akeneo\Component\Batch\Model\JobExecution))
#27 /vagrant/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php(259): Akeneo\Bundle\BatchBundle\Command\BatchCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /vagrant/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(886): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /vagrant/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Akeneo\Bundle\BatchBundle\Command\BatchCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /vagrant/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(96): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /vagrant/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(126): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /vagrant/app/console(29): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#33 {main}"}]] []

Found this https://github.com/phpseclib/phpseclib/issues/669

Fixed by overriding flysystem-sftp in composer.json:

"require": {
        "akeneo/pim-community-dev": "~1.6.3",
        "doctrine/mongodb-odm-bundle": "3.2.0",
        "akeneo-labs/pim-enhanced-connector": "1.3.*",
        "league/flysystem-sftp": "1.0.10 as 1.0.5",
        ...
}
nidup commented 7 years ago

Hi @mathewrapid

Thanks a lot for raising this issue.

I'm surprised because I don't see any part of the PIM using the namespace League\Flysystem\Sftp, I'm doing extra tests to understand why we put "league/flysystem-sftp" in our composer.json as it's a optional dependency (at least for now it looks like it is, it's only pulled as require-dev by oneup flysystem bundle).

If we don't use it by default in the PIM, we should not add it in our composer.json and in this case you could use the version you want to use in your project without any issue (as you could add another adapter for your own needs).

I keep you posted soon, the fact to change our composer.json in an already released version is a very very sensitive topic as it impacts all users :)

nidup commented 7 years ago

Hi @mathewrapid

After double checking, we removed this useless dep from our composer.json, the fix will be available with the upcoming v1.6.4 release that should be done in coming days.

Don't hesitate to raise any other issue you could encounter, these kind of feedback are really valuable for us, and we recently changed our internal organization to be able to better take them in account than in the past, so it's also a good test for us :)

Have a good day.