Core dump when running script to get a file

A bit confused…
What is the meaning of “Everything is fine until it starts the download, then I get the message shown in my first post.”?
What is the message shown in your first post?

HI @jyijyi,
What I mean is the script runs fine until it starts the download. All the hands shakes and security protocols go fine, then it starts the download and I get this message:

5616File size limit exceeded (core dumped).

That’s like 5.6KBytes. Not very much.
I can run the script from the command line and it works fine and downloads the file (just under 6 meg). I redirected standard output to a file to find out why it was failing.

Steve

How about you compile a simple hello world application with the toolchain like:

/home/owner/legato/packages/legato.toolchain.1.7.3.SWI9X15Y_07112100-wp85-wp750x-native-x86_64-201701091132/resources/native/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -o hello.arm.o hello.c

Inside the hello.c, you can call your script by system() API.

This experiment can isolate if your problem is only related to legato application.

That won’t work as I have a WP7601, but I get your point. I will try and get back to you.

I can’t get it to link. It can’t find the libs for some reason.

Hi @EvetsMostel
Legato apps sandboxes have by default a quite low limit for their temporary file system.
cf http://legato.io/legato-docs/latest/defFilesAdef.html#defFilesAdef_maxFileSystemBytes

I’m not running this sandboxed. And I’ve changed the maxFileBytes to 10512K, or 10.5Meg. I’ve also changed the maxFileSystemBytes: to 10512K as well. Neither of these affected this problem.

@jyijyi,
I was able to get the program to link. Runs flawlessly, but again, I’m running it from a bash shell, which the script works without the exe calling it. However, if I launch the exe via Legato, then I get the same error, File size limit exceeded (core dumped). I’m downloading the file to /home/root, so there should be no legato filesize issue. Again, all the MaxFileSize and MaxSystemFileSize limits have been raised to 10.5Meg. I can successfully download the file via a connection from a web page served from this device. What setting do I need to “adjust” to get this to work?
I even tried running this in the background, but it still hits that limitation.

how about using the binary program hello.o to call your script by system() API?

I did. That’s what I was saying. But the effect is the same. If I run my binary program to call the script, I’m starting it from the command line and it works. If I call the same binary program from my legato app, it gives me the File size limit exceeded (core dumped) error.

Can you attach your script here so that we can reproduce the issue on MangoH green board?

No, because this is a public forum and for security measures it has keys in the script. But you can do it by creating an AWS S3 resource and putting a 6 Meg file there.

Here is the template script:
#!/bin/sh
outputFile=“Your_PATH”
amzFile=“AMAZON_FILE_PATH”
bucket=“YOUR_BUCKET”
resource="/{bucket}/{amzFile}"
contentType=“application/x-compressed-tar”
dateValue=date -R
stringToSign=“GET\n\n${contentType}\n${dateValue}\n${resource}”
s3Key=“YOUR_S3_KEY”
s3Secret=“YOUR_S3SECRET”
signature=echo -en ${stringToSign} | openssl sha1 -hmac ${s3Secret} -binary | base64

curl -H “Host: {bucket}.s3.amazonaws.com" \ -H "Date: {dateValue}”
-H "Content-Type: {contentType}" \ -H "Authorization: AWS {s3Key}:{signature}" \ https://{bucket}.s3.amazonaws.com/${amzFile} -o $outputFile

You will need to compile base64 from the gnu coreutils as that isn’t included in the image. I used v8.25 since that matches the other things that are on Yocto.

I even went so far as to create a service which would start the binary created in the last exercise at boot (after everything), wait for an internet connection, then go get the file. However, I can’t seem to get it to automatically start for some reason. I can run it from the command line with /etc/init.d/scriptname.sh start, and that works. So I thought that I could run it from the Legato app that way, since I’m not actually starting it. However, I get the same issue, although the cutoff point seems to be slightly higher, but not much.

I tried on WP750x.
I put the test script here:


root@swi-mdm9x15:/tmp# cat /tmp/test.sh
curl -o /dev/null -k https://116.66.221.43:5048/data.txt


After that I run a unsandboxed legato application:


#include “legato.h”

COMPONENT_INIT
{
system("/tmp/test.sh");
LE_INFO(“Hello, world.”);
}


No problem is found.
Would you please modify my script to reproduce the issue?

So, Not sure what to tell you since you are running on a different device. However, I did find these two things that allowed me to get it to work.

  1. R7, doesn’t work (17.11 Legato, WP7601) regardless of where you put it.
  2. R8 will work, but like you did in you script, it depends on where the file it going. I was using a relative path thinking it would be relative to the script, but in fact it was relative to where my app was in Legato. When I corrected that to put it where I wanted it, it worked fine, but again, it had to be R8 (18.1.0) for my device, WP7601.
    In that case, does the filesize set in Legato make any difference?

this is issue is solved.

Hi EvetsMostel
Have you solved this problem? I have the same problem

What is the cause of this problem? Where can I find a solution?

@haha
In your adef file, you must change the maxFileBytes: and the maxFileSystemBytes sizes to allow for the size of your file.

Evets

Can you tell me how to solve this issue? thinks

I am reopening this Bug.
Still using WP7603(-1) and the problem is similar, only I don’t get any errors, it just slows down and stops after about 30+ Meg.
I’ve got the maxFileBytes and maxFileSystemBytes set to 100512K.
I am running R10.1 (Legato version 18.06.3)
I can run my script from the shell cmd line with no issues. It downloads my full update ~65Meg .spk file. I can then run fwupdate using that file and update my app. All is well.
However, if I call the script from a Legato app, the download slows down to a crawl and stops somewhere north of 30Meg. I am downloading to the /tmp directory. Again, this works if run from a terminal window.
What is causing this?
Evets

Solved: I had to use /home/root to put the file there. Then everything works. /tmp apparently gets too full sometimes for that big of a file. Of course, in order to put a file there you have to have your app run as not sandboxed.
Evets