Skip to content

Major problem after project rename and clean build #91

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

Closed
cyberreefguru opened this issue Dec 1, 2013 · 41 comments
Closed

Major problem after project rename and clean build #91

cyberreefguru opened this issue Dec 1, 2013 · 41 comments

Comments

@cyberreefguru
Copy link

I just tried to rename my project and then recompile. The recompile did not work so I cleaned all. The plugin proceeded to execute "rm -rf /". I guess it intended to remove the release folder, but something was missing and it attempted to remove everything from my computer. It started with the Applications folder and made to it to the calendar app before I figured out what was wrong. Fortunately most of the files were owned by root preventing the remove from working properly. It did manage to delete the arduino application but I'm not sure what else. I'm happy to zip up the project directory if you want; the .cproject file looks like the {project.home}/Release was deleted from the build tools.

MacOS 10.8.5
Eclipse IDE for C/C++ Developers
Version: Juno Service Release 2
Build id: 20130225-0426
Arduino eclipse extensions 2.1.0.4
Eclipse IDE for C/C++ Developers 1.5.2.20130211-1820
Subversive SVN Connectors 3.0.0.I20130122-1700
Subversive SVN Team Provider 1.0.0.I20130122-1700
SVNKit 1.3.8 Implementation (Optional) 3.0.0.I20121228-1700

@jantje
Copy link
Member

jantje commented Dec 1, 2013

This sounds really bad.
The clean command is "rm -rf" and should be run in {project}/{configuration} for one reason or another it looks like a /was added to the command. I tried to rename a project starting with / but eclipse refuses to do so (on linux)
can you zip up the workspace and send it to [email protected]?
Best regards
Jantje

@cyberreefguru
Copy link
Author

Jantje - thanks for the quick reply. I renamed the project without specifying a path; I simply right clicked on the project name and selected "Rename…". I don't really want to try and reproduce the error, but I can tell you selecting clean build definitely tried to delete everything from / on down on my machine. I did it twice until I figured out what was going on.

The project is attached.

On Dec 1, 2013, at 5:49 PM, jantje [email protected] wrote:

This sounds really bad.
The clean command is "rm -rf" and should be run in {project}/{configuration} for one reason or another it looks like a /was added to the command. I tried to rename a project starting with / but eclipse refuses to do so (on linux)
can you zip up the workspace and send it to [email protected]?
Best regards
Jantje


Reply to this email directly or view it on GitHub.

@jantje
Copy link
Member

jantje commented Dec 1, 2013

I'm sorry but I can't find the attachment.
Jantje

On 01-Dec-13 23:54, Thomas Sasala wrote:

Jantje - thanks for the quick reply. I renamed the project without
specifying a path; I simply right clicked on the project name and
selected "Rename…". I don't really want to try and reproduce the
error, but I can tell you selecting clean build definitely tried to
delete everything from / on down on my machine. I did it twice until I
figured out what was going on.

The project is attached.

On Dec 1, 2013, at 5:49 PM, jantje [email protected] wrote:

This sounds really bad.
The clean command is "rm -rf" and should be run in
{project}/{configuration} for one reason or another it looks like a
/was added to the command. I tried to rename a project starting with /
but eclipse refuses to do so (on linux)
can you zip up the workspace and send it to [email protected]?
Best regards
Jantje


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#91 (comment).

@cyberreefguru
Copy link
Author

it seems it won't come through with email and i can't attach a zip file through the web site. do you have an area i can drop it?

@jantje
Copy link
Member

jantje commented Dec 2, 2013

I have no public area to drop files. Normally mail should do for source code. How big is it? Have you compressed it?
Best regards
Jantje

@cyberreefguru
Copy link
Author

It's 12K zipped. I uploaded it to my website but I don't necessarily want to publish the URL here.

On Dec 2, 2013, at 8:09 AM, jantje [email protected] wrote:

I have no public area to drop files. Normally mail should do for source code. How big is it? Have you compressed it?
Best regards
Jantje


Reply to this email directly or view it on GitHub.

@jantje
Copy link
Member

jantje commented Dec 3, 2013

12K should fit the mailbox.
you can send the url or zip to [email protected].

@jantje
Copy link
Member

jantje commented Feb 19, 2014

I finally had some time to look at the zip but ....
There was not .metadata folder so I had to import the project. Clean did not generate any problems.
Not sure how to process this one.

@jantje
Copy link
Member

jantje commented Jul 3, 2014

I'm closing this one as a one off.

@jantje jantje closed this as completed Jul 3, 2014
@freebs
Copy link

freebs commented Feb 4, 2015

Feb 3, 2015: I just had the same thing happen to me on my Mac. (OS X 10.10.2) Eclipse stable version (V2.3_mac64.2014-07-12_02-06-35.tar.gz). I was fooling around trying to get Serial to read for Arduino, by adding a couple of directories. Finally tried to do a build clean and both fans went on and things seemed to freeze on the bar-graph. I changed to see the other view and watched as it rm'd file after file. Half my Applications were deleted from /Macintosh HD/Applications along with G*d knows what else. By the time I looked, it was working on removing files in /Xcode directories.
screen shot 2015-02-03 at 11 25 41 pm
This is my dock, 'after'. The question marks are rm'd applications. Tragically, they're not in Trash and can't be 'put back'. They will all need to be reinstalled.
Note that I can't send anything because the Eclipse app and the Arduino app were both deleted during this event.

@jantje
Copy link
Member

jantje commented Feb 4, 2015

I'm sorry you had this very annoying problem.
I have been thinking about this again and the only way (apart from an obscure bug somewhere in the software stack) I can think of this happening is that the settings on "project->properties->C/C++ build->behaviour" or "project->properties->C/C++ build->builder settings" have been changed.
In luna they should look like this.
behavior
buildersettings

Some background info. CDT uses make to build the code. Make is a command line tool. To clean the project the "rm" command is used. if the command is changed to "rm /" your whole disk will be whiped (that is when you have the right to do so). Also if the command is preceded with "cd /" again your whole disk will be cleaned.

@freebs
Copy link

freebs commented Feb 4, 2015

Hi,
I wasn't changing those settings; just adding some environment ones per this post: [ http://stackoverflow.com/questions/10973787/arduino-eclipse-can-not-resolve-serial ] . I was attempting to resolve a problem where the Serial library was not being seen during the build and had added the recommended path and /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/libraries/SoftwareSerial .
I had not changed any of the build settings themselves (they were 'default', except the recommended "Save before build" setting mentioned in the Welcome screen).

@jantje
Copy link
Member

jantje commented Feb 4, 2015

As both reporters work on mac it may be a mac related issue. I have a mac at my disposal next week so I'll give it a try.
@freebs have you also renamed a project? Have you been using the plugin before or was it a new install? Can you remember you did a build before? If you did a build before was that the project that caused the problem? Anything else you remember that could help me fix the problem?

@freebs Not related but in response to your comment.
The Serial workaround is not needed in your setup. A compile may be needed before serial will be recognized. If you have a .ino file adding #include arduino.h to the ino file may be needed.

@jantje jantje reopened this Feb 4, 2015
@freebs
Copy link

freebs commented Feb 20, 2015

Hi, it's taken so long to get back to you with an answer.

This was a new install (though I had previously downloaded v2 and tried that, I was having trouble with versions of Arduino vs the Eclipse IDE and had downloaded different combinations)

I did rename some items, but only using in-editor functionality, not from the operating system side.

While I had tried builds, they were mostly failing because of libraries not found... which is why I was trying the combinations of things to add to the search paths. When all the builds kept failing I came across the 'build new' and thought that would 'flush' any possible old files and redo from new.

Thanks for the tip above. I'll give that a try.

@jantje
Copy link
Member

jantje commented May 5, 2015

I don't know what to do with this issue. I'm sure it is a genuine request but it also seems to hardly ever happen.

@jantje jantje added importance: usability status: no good solution found (yet) We don't know how to fix this. status: waiting for input OP was requested to provide more info. (issues in this state longer than a month will be closed) labels May 27, 2015
@dcnewman
Copy link

I've seen it as well on OS X 10.9 and the v2.3_mac64.2014-07-12_02-06-35 stable package. Did a simple verify, clean started running, and next thing I knew it was trying to delete everything in /Applications. It may have been doing in / and just got /Applications first. Dunno.

I'll try the plugin on a Linux VM...

@dcnewman
Copy link

If there's a way to generate the build instructions without executing them, I'm willing to try that as a means of helping diagnose what is happening.

@jantje
Copy link
Member

jantje commented Jul 15, 2015

I think that for one reason or another the rm-rf command is executed in the root.
I thought that you could specify the command somewhere in the gui but I cant find it back. Anyway as I explain below the plugin overrules that one anyway.

To investigate this issue you could change the rm -rf command.
There are some options I see.

  1. change the arduino plugin code. /it.baeyens.arduino.core/src/it/baeyens/arduino/toolchain/ArduinoGnuMakefileGenerator.java look for rm -rf and change in what you want. Compile and investigate.
  2. Change your system so that rm is not running rm but your own script. You could check the path and only execute the rm command in case you like it. In case you do not like it try to log as much info you can to help investigation.
  3. combine the 2 and use my_rm.

Some background info. The ArduinoGnuMakefileGenerator.java is a copy of GnuMakefileGenerator.java delivered by CDT to allow the plugin to work. I have just compared the current version of the files and all seems well. (read no changes in CDT)
The rm section is different. My code is

String cleanCommand = "rm -rf";

the cdt code is

        String cleanCommand = config.getCleanCommand();

        try {
            cleanCommand = ManagedBuildManager.getBuildMacroProvider()
                    .resolveValueToMakefileFormat(config.getCleanCommand(),
                            EMPTY_STRING, WHITESPACE,
                            IBuildMacroProvider.CONTEXT_CONFIGURATION, config);
        } catch (BuildMacroException e) {
        }

I can't recall why I decided to hard code the command.

As I find nothing on CDT having this issue; it is probably related to my changes.
Things that make me think ... maybe are
ensurePathIsGNUMakeTargetRuleCompatibleSyntax
In the method

private StringBuffer addMacros()

I moved

buffer.append("-include subdir.mk" + NEWLINE); 

from after to before this block of code

    List<String> subDirList = new ArrayList<String>();
    for (IContainer subDir : getSubdirList()) {
        IPath projectRelativePath = subDir.getProjectRelativePath();
        if (!projectRelativePath.toString().equals(""))
        subDirList.add(0, projectRelativePath.toString());
    }
    Collections.sort(subDirList, Collections.reverseOrder());
    for (String dir : subDirList) {
        buffer.append("-include " + escapeWhitespaces(dir) + SEPARATOR + "subdir.mk" + NEWLINE);
    }

@dcnewman
Copy link

Thanks for the details. It may be a couple of days before I can get back with info as I'll need to setup a build env. for the Arduino Eclipse plugin in order to investigate.

@jantje
Copy link
Member

jantje commented Jul 15, 2015

read the read.me file on how to setup an environment. piece of cake thanks to wim :-)

@dcnewman
Copy link

Piece of cake to get launched, but didn't finish

mvn verify -Pmac64,mars
...
[INFO] Fetching content.jar from http://download.eclipse.org/technology/nebula/snapshot/ (0B of 37.12kB at 0B/s)
[INFO] Resolving dependencies of MavenProject: com.github.brodykenrick.arduino-eclipse-plugin:it.baeyens.arduino.core.nl1:2.4.0-SNAPSHOT @ /Users/dnewman/git/arduino-eclipse-plugin/it.baeyens.arduino.core.nl1/pom.xml
[INFO] Cannot complete the request. Generating details.
[INFO] Cannot complete the request. Generating details.
[INFO] {osgi.ws=cocoa, osgi.os=macosx, osgi.arch=x86_64, org.eclipse.update.install.features=true}
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: it.baeyens.arduino.core.nl1 2.4.0.qualifier
[ERROR] Missing requirement: it.baeyens.arduino.core 2.4.0.qualifier requires 'bundle org.eclipse.core.runtime 0.0.0' but it could not be found
[ERROR] Cannot satisfy dependency: it.baeyens.arduino.core.nl1 2.4.0.qualifier depends on: bundle it.baeyens.arduino.core 2.1.0
[ERROR]
[ERROR] Internal error: java.lang.RuntimeException: No solution found because the problem is unsatisfiable.:

@jantje
Copy link
Member

jantje commented Jul 18, 2015

mvn verify -Pmac64,luna
works on my system.
The build engine still uses luna. Seems we will have a migration issue when going to mars.

@dcnewman
Copy link

Okay, I'll build with Luna. I was trying to use Mars since that's the version of Eclipse I was using when the dirty deed (rm -rf /) occurred.

@wimjongman
Copy link
Member

Please file an issue and assign to me.

Sent from TypeMail

On Jul 18, 2015, 16:36, at 16:36, jantje [email protected] wrote:

mvn verify -Pmac64,luna
works on my system.
The build engine still uses luna. Seems we will have a migration issue
when going to mars.


Reply to this email directly or view it on GitHub:
#91 (comment)

@dcnewman
Copy link

I edited ArduinoGnuMakefileGenerator.java to use a shell script in place of "rm -rf". Here's the command generated when I did a "clean" for the project. Now I reconstructed the project and so it would seem that this time around, the dirty deed of "rm -rf /" is not (yet) occuring. I'll try a few more things. Also, RM.sh logged the current working directory. It wasn't / . It was a subdirectory of the project directory as expected..

make clean
/Users/dnewman/bin/RM.sh -rf ./.metadata/.plugins/org.eclipse.cdt.make.core/specs.c.d arduino.ar RepRapFirmware.bin RepRapFirmware.eep RepRapFirmware.elf ./DDA.cpp.d ./DeltaParameters.cpp.d ./DeltaProbe.cpp.d ./DriveMovement.cpp.d ./GCodeBuffer.cpp.d ./GCodes.cpp.d ./Heat.cpp.d ./Isqrt.cpp.d ./Move.cpp.d ./Network.cpp.d ./Platform.cpp.d ./PrintMonitor.cpp.d ./RepRapFirmware.cpp.d ./Tool.cpp.d ./Webserver.cpp.d ./.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp.d ./DDA.cpp.o ./DeltaParameters.cpp.o ./DeltaProbe.cpp.o ./DriveMovement.cpp.o ./GCodeBuffer.cpp.o ./GCodes.cpp.o ./Heat.cpp.o ./Isqrt.cpp.o ./Move.cpp.o ./Network.cpp.o ./Platform.cpp.o ./PrintMonitor.cpp.o ./RepRapFirmware.cpp.o ./Tool.cpp.o ./Webserver.cpp.o ./.metadata/.plugins/org.eclipse.cdt.make.core/specs.c.o ./.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp.o RepRapFirmware

@jantje
Copy link
Member

jantje commented Jul 23, 2015

Good work.
I always assumed that wild-cards would be used in the rm command. The output provided by you shows only fully qualified file names (except for RepRapFirmware) . As such the -r option (which means recursive directory) is unnecessary and introduces danger.
If we can remove the -r option that would be great.
In your testing: Please keep an eye on wild-cards and needs for recursion.

@dcnewman
Copy link

Well, for your amusement, here's the protective script which is run in place of "rm" when a clean is done. It should catch any bad behavior.

#!/bin/bash

SWITCHES=
SAFEHOME=/Users/dnewman
GIT=$SAFEHOME/git

# Make sure our current working directory is sane

CWD=$(pwd)
if [[ ( "$CWD" != $GIT/RepRapFirmware ) && ( "$CWD" != $GIT/RepRapFirmware/* ) ]] ;
then
    echo "***** CURRENT WORKING DIRECTORY IS UNSOUND, $CWD *****"
    exit 1
fi

# Assume options all in $1
# save them and strip 'r' from them

if [[ "$1" == -* ]] ;
then
    SWITCHES=$(echo "$1" | tr -d r)
    shift
fi

while (( "$#" )); do

    # Special case trapping / just to be extra paranoid

    if [[ "$1" == "/" ]] ;
    then
        echo "***** TRIED TO DELETE / ****"
        exit 1
    fi

    # Now trap anything out of

    if [[ ( "$1" == /* ) && ( "$1" != $GIT/eclipse* ) && ( "$1" != $GIT/RepRapFirmware/Release/* ) ]] ;
    then
        echo "***** TRIED TO DELETE SOMETHING BAD, $1 *****"
        exit 1
    fi

    echo "rm $SWITCHES $1"
    rm "$SWITCHES" "$1"
    shift

done

@jantje
Copy link
Member

jantje commented Jul 23, 2015

I feel you will find the problem :-)

@dcnewman
Copy link

Well, it is trying to delete something spurious, the very last item "RepRapFirmware". No such object exists and I'm unclear of why it's trying to be deleted. But I have an inkling of where it might have come from.

Namely, "RepRapFirmware" is the name of the project. As in ProjName == RepRapFirmware. And, under the Project Preferences, I spy in C/C++ Build > Settings > Build Artifact a mystery artifact shown as having no artifact type (it's blank), an artifact name of ${ProjName} with no extension or output prefix. I didn't put that artifact there; it must have come from when I made the initial Arduino Sketch? (I made a new sketch then imported all this RepRapFirmware goodness into it after first purging it of stuff which arguably shouldn't have been in the repo in the first place -- .metadata/, .settings/, etc.)

Now, I have no idea how that artifact arose. But I'm am wondering if the "clean" is trying to remove artifacts and thus is doing a "rm -rf ${ProjName}" and hence the mystery "rm -rf RepRapFirmware" shown below. (Again, no such object exists.) And if that is the case, then I have to wonder if in my previous encounter, I somehow had a mystery artifact which was "/".

** Clean-only build of configuration Release for project RepRapFirmware ****
make clean 
/Users/dnewman/bin/RM.sh -rf  ./arduino/dtostrf.c.d  ./arduino/WInterrupts.c.d ./arduino/cortex_handlers.c.d ./arduino/hooks.c.d ./arduino/iar_calls_sam3.c.d ./arduino/itoa.c.d ./arduino/syscalls_sam3.c.d ./arduino/wiring.c.d ./arduino/wiring_analog.c.d ./arduino/wiring_digital.c.d ./arduino/wiring_shift.c.d  ./Libraries/SD_HSMCI/utility/ccsbcs.c.d ./Libraries/SD_HSMCI/utility/ctrl_access.c.d ./Libraries/SD_HSMCI/utility/diskio.c.d ./Libraries/SD_HSMCI/utility/dmac.c.d ./Libraries/SD_HSMCI/utility/fattime_rtc.c.d ./Libraries/SD_HSMCI/utility/ff.c.d ./Libraries/SD_HSMCI/utility/hsmci.c.d ./Libraries/SD_HSMCI/utility/rtc.c.d ./Libraries/SD_HSMCI/utility/sd_mmc.c.d ./Libraries/SD_HSMCI/utility/sd_mmc_mem.c.d  ./Libraries/Lwip/lwip/src/sam/netif/ethernetif.c.d  ./Libraries/Lwip/lwip/src/netif/etharp.c.d  ./Libraries/Lwip/lwip/src/core/ipv4/autoip.c.d ./Libraries/Lwip/lwip/src/core/ipv4/icmp.c.d ./Libraries/Lwip/lwip/src/core/ipv4/igmp.c.d ./Libraries/Lwip/lwip/src/core/ipv4/inet.c.d ./Libraries/Lwip/lwip/src/core/ipv4/inet_chksum.c.d ./Libraries/Lwip/lwip/src/core/ipv4/ip.c.d ./Libraries/Lwip/lwip/src/core/ipv4/ip_addr.c.d ./Libraries/Lwip/lwip/src/core/ipv4/ip_frag.c.d  ./Libraries/Lwip/lwip/src/core/def.c.d ./Libraries/Lwip/lwip/src/core/dhcp.c.d ./Libraries/Lwip/lwip/src/core/dns.c.d ./Libraries/Lwip/lwip/src/core/init.c.d ./Libraries/Lwip/lwip/src/core/lwip_timers_140.c.d ./Libraries/Lwip/lwip/src/core/mem.c.d ./Libraries/Lwip/lwip/src/core/memp.c.d ./Libraries/Lwip/lwip/src/core/netif.c.d ./Libraries/Lwip/lwip/src/core/pbuf.c.d ./Libraries/Lwip/lwip/src/core/raw.c.d ./Libraries/Lwip/lwip/src/core/stats.c.d ./Libraries/Lwip/lwip/src/core/sys.c.d ./Libraries/Lwip/lwip/src/core/tcp.c.d ./Libraries/Lwip/lwip/src/core/tcp_in.c.d ./Libraries/Lwip/lwip/src/core/tcp_out.c.d ./Libraries/Lwip/lwip/src/core/udp.c.d  ./Libraries/Lwip/lwip/src/api/api_lib.c.d ./Libraries/Lwip/lwip/src/api/api_msg.c.d ./Libraries/Lwip/lwip/src/api/err.c.d ./Libraries/Lwip/lwip/src/api/netbuf.c.d ./Libraries/Lwip/lwip/src/api/netdb.c.d ./Libraries/Lwip/lwip/src/api/netifapi.c.d ./Libraries/Lwip/lwip/src/api/sockets.c.d ./Libraries/Lwip/lwip/src/api/tcpip.c.d  ./Libraries/Lwip/contrib/apps/netbios/netbios.c.d  ./Libraries/EMAC/ethernet_phy.c.d ./Libraries/EMAC/ethernet_sam.c.d  arduino.ar  RepRapFirmware.bin  RepRapFirmware.eep  RepRapFirmware.elf  ./arduino/variant.cpp.o  ./arduino/dtostrf.c.o  ./arduino/CDC.cpp.o ./arduino/HID.cpp.o ./arduino/USBCore.cpp.o  ./arduino/IPAddress.cpp.o ./arduino/Print.cpp.o ./arduino/Reset.cpp.o ./arduino/RingBuffer.cpp.o ./arduino/Stream.cpp.o ./arduino/UARTClass.cpp.o ./arduino/USARTClass.cpp.o ./arduino/WInterrupts.c.o ./arduino/WMath.cpp.o ./arduino/WString.cpp.o ./arduino/abi.cpp.o ./arduino/cortex_handlers.c.o ./arduino/hooks.c.o ./arduino/iar_calls_sam3.c.o ./arduino/itoa.c.o ./arduino/main.cpp.o ./arduino/new.cpp.o ./arduino/syscalls_sam3.c.o ./arduino/wiring.c.o ./arduino/wiring_analog.c.o ./arduino/wiring_digital.c.o ./arduino/wiring_pulse.cpp.o ./arduino/wiring_shift.c.o  ./DDA.cpp.d ./DeltaParameters.cpp.d ./DeltaProbe.cpp.d ./DriveMovement.cpp.d ./GCodeBuffer.cpp.d ./GCodes.cpp.d ./Heat.cpp.d ./Isqrt.cpp.d ./Move.cpp.d ./Network.cpp.d ./Platform.cpp.d ./PrintMonitor.cpp.d ./RepRapFirmware.cpp.d ./Tool.cpp.d ./Webserver.cpp.d  ./arduino/variant.cpp.d  ./arduino/CDC.cpp.d ./arduino/HID.cpp.d ./arduino/USBCore.cpp.d  ./arduino/IPAddress.cpp.d ./arduino/Print.cpp.d ./arduino/Reset.cpp.d ./arduino/RingBuffer.cpp.d ./arduino/Stream.cpp.d ./arduino/UARTClass.cpp.d ./arduino/USARTClass.cpp.d ./arduino/WMath.cpp.d ./arduino/WString.cpp.d ./arduino/abi.cpp.d ./arduino/main.cpp.d ./arduino/new.cpp.d ./arduino/wiring_pulse.cpp.d  ./Libraries/Wire/Wire.cpp.d  ./Libraries/SamNonDuePin/SamNonDuePin.cpp.d  ./Libraries/MCP4461/MCP4461.cpp.d  ./Libraries/Flash/DueFlashStorage.cpp.d ./Libraries/Flash/efc.cpp.d ./Libraries/Flash/flash_efc.cpp.d  ./DDA.cpp.o ./DeltaParameters.cpp.o ./DeltaProbe.cpp.o ./DriveMovement.cpp.o ./GCodeBuffer.cpp.o ./GCodes.cpp.o ./Heat.cpp.o ./Isqrt.cpp.o ./Move.cpp.o ./Network.cpp.o ./Platform.cpp.o ./PrintMonitor.cpp.o ./RepRapFirmware.cpp.o ./Tool.cpp.o ./Webserver.cpp.o  ./Libraries/Wire/Wire.cpp.o  ./Libraries/SamNonDuePin/SamNonDuePin.cpp.o  ./Libraries/SD_HSMCI/utility/ccsbcs.c.o ./Libraries/SD_HSMCI/utility/ctrl_access.c.o ./Libraries/SD_HSMCI/utility/diskio.c.o ./Libraries/SD_HSMCI/utility/dmac.c.o ./Libraries/SD_HSMCI/utility/fattime_rtc.c.o ./Libraries/SD_HSMCI/utility/ff.c.o ./Libraries/SD_HSMCI/utility/hsmci.c.o ./Libraries/SD_HSMCI/utility/rtc.c.o ./Libraries/SD_HSMCI/utility/sd_mmc.c.o ./Libraries/SD_HSMCI/utility/sd_mmc_mem.c.o  ./Libraries/MCP4461/MCP4461.cpp.o  ./Libraries/Lwip/lwip/src/sam/netif/ethernetif.c.o  ./Libraries/Lwip/lwip/src/netif/etharp.c.o  ./Libraries/Lwip/lwip/src/core/ipv4/autoip.c.o ./Libraries/Lwip/lwip/src/core/ipv4/icmp.c.o ./Libraries/Lwip/lwip/src/core/ipv4/igmp.c.o ./Libraries/Lwip/lwip/src/core/ipv4/inet.c.o ./Libraries/Lwip/lwip/src/core/ipv4/inet_chksum.c.o ./Libraries/Lwip/lwip/src/core/ipv4/ip.c.o ./Libraries/Lwip/lwip/src/core/ipv4/ip_addr.c.o ./Libraries/Lwip/lwip/src/core/ipv4/ip_frag.c.o  ./Libraries/Lwip/lwip/src/core/def.c.o ./Libraries/Lwip/lwip/src/core/dhcp.c.o ./Libraries/Lwip/lwip/src/core/dns.c.o ./Libraries/Lwip/lwip/src/core/init.c.o ./Libraries/Lwip/lwip/src/core/lwip_timers_140.c.o ./Libraries/Lwip/lwip/src/core/mem.c.o ./Libraries/Lwip/lwip/src/core/memp.c.o ./Libraries/Lwip/lwip/src/core/netif.c.o ./Libraries/Lwip/lwip/src/core/pbuf.c.o ./Libraries/Lwip/lwip/src/core/raw.c.o ./Libraries/Lwip/lwip/src/core/stats.c.o ./Libraries/Lwip/lwip/src/core/sys.c.o ./Libraries/Lwip/lwip/src/core/tcp.c.o ./Libraries/Lwip/lwip/src/core/tcp_in.c.o ./Libraries/Lwip/lwip/src/core/tcp_out.c.o ./Libraries/Lwip/lwip/src/core/udp.c.o  ./Libraries/Lwip/lwip/src/api/api_lib.c.o ./Libraries/Lwip/lwip/src/api/api_msg.c.o ./Libraries/Lwip/lwip/src/api/err.c.o ./Libraries/Lwip/lwip/src/api/netbuf.c.o ./Libraries/Lwip/lwip/src/api/netdb.c.o ./Libraries/Lwip/lwip/src/api/netifapi.c.o ./Libraries/Lwip/lwip/src/api/sockets.c.o ./Libraries/Lwip/lwip/src/api/tcpip.c.o  ./Libraries/Lwip/contrib/apps/netbios/netbios.c.o  ./Libraries/Flash/DueFlashStorage.cpp.o ./Libraries/Flash/efc.cpp.o ./Libraries/Flash/flash_efc.cpp.o  ./Libraries/EMAC/ethernet_phy.c.o ./Libraries/EMAC/ethernet_sam.c.o  RepRapFirmware
rm -f ./arduino/dtostrf.c.d
rm -f ./arduino/WInterrupts.c.d
rm -f ./arduino/cortex_handlers.c.d
rm -f ./arduino/hooks.c.d
rm -f ./arduino/iar_calls_sam3.c.d
rm -f ./arduino/itoa.c.d
rm -f ./arduino/syscalls_sam3.c.d
rm -f ./arduino/wiring.c.d
rm -f ./arduino/wiring_analog.c.d
rm -f ./arduino/wiring_digital.c.d
rm -f ./arduino/wiring_shift.c.d
rm -f ./Libraries/SD_HSMCI/utility/ccsbcs.c.d
rm -f ./Libraries/SD_HSMCI/utility/ctrl_access.c.d
rm -f ./Libraries/SD_HSMCI/utility/diskio.c.d
rm -f ./Libraries/SD_HSMCI/utility/dmac.c.d
rm -f ./Libraries/SD_HSMCI/utility/fattime_rtc.c.d
rm -f ./Libraries/SD_HSMCI/utility/ff.c.d
rm -f ./Libraries/SD_HSMCI/utility/hsmci.c.d
rm -f ./Libraries/SD_HSMCI/utility/rtc.c.d
rm -f ./Libraries/SD_HSMCI/utility/sd_mmc.c.d
rm -f ./Libraries/SD_HSMCI/utility/sd_mmc_mem.c.d
rm -f ./Libraries/Lwip/lwip/src/sam/netif/ethernetif.c.d
rm -f ./Libraries/Lwip/lwip/src/netif/etharp.c.d
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/autoip.c.d
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/icmp.c.d
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/igmp.c.d
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/inet.c.d
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/inet_chksum.c.d
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/ip.c.d
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/ip_addr.c.d
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/ip_frag.c.d
rm -f ./Libraries/Lwip/lwip/src/core/def.c.d
rm -f ./Libraries/Lwip/lwip/src/core/dhcp.c.d
rm -f ./Libraries/Lwip/lwip/src/core/dns.c.d
rm -f ./Libraries/Lwip/lwip/src/core/init.c.d
rm -f ./Libraries/Lwip/lwip/src/core/lwip_timers_140.c.d
rm -f ./Libraries/Lwip/lwip/src/core/mem.c.d
rm -f ./Libraries/Lwip/lwip/src/core/memp.c.d
rm -f ./Libraries/Lwip/lwip/src/core/netif.c.d
rm -f ./Libraries/Lwip/lwip/src/core/pbuf.c.d
rm -f ./Libraries/Lwip/lwip/src/core/raw.c.d
rm -f ./Libraries/Lwip/lwip/src/core/stats.c.d
rm -f ./Libraries/Lwip/lwip/src/core/sys.c.d
rm -f ./Libraries/Lwip/lwip/src/core/tcp.c.d
rm -f ./Libraries/Lwip/lwip/src/core/tcp_in.c.d
rm -f ./Libraries/Lwip/lwip/src/core/tcp_out.c.d
rm -f ./Libraries/Lwip/lwip/src/core/udp.c.d
rm -f ./Libraries/Lwip/lwip/src/api/api_lib.c.d
rm -f ./Libraries/Lwip/lwip/src/api/api_msg.c.d
rm -f ./Libraries/Lwip/lwip/src/api/err.c.d
rm -f ./Libraries/Lwip/lwip/src/api/netbuf.c.d
rm -f ./Libraries/Lwip/lwip/src/api/netdb.c.d
rm -f ./Libraries/Lwip/lwip/src/api/netifapi.c.d
rm -f ./Libraries/Lwip/lwip/src/api/sockets.c.d
rm -f ./Libraries/Lwip/lwip/src/api/tcpip.c.d
rm -f ./Libraries/Lwip/contrib/apps/netbios/netbios.c.d
rm -f ./Libraries/EMAC/ethernet_phy.c.d
rm -f ./Libraries/EMAC/ethernet_sam.c.d
rm -f arduino.ar
rm -f RepRapFirmware.bin
rm -f RepRapFirmware.eep
rm -f RepRapFirmware.elf
rm -f ./arduino/variant.cpp.o
rm -f ./arduino/dtostrf.c.o
rm -f ./arduino/CDC.cpp.o
rm -f ./arduino/HID.cpp.o
rm -f ./arduino/USBCore.cpp.o
rm -f ./arduino/IPAddress.cpp.o
rm -f ./arduino/Print.cpp.o
rm -f ./arduino/Reset.cpp.o
rm -f ./arduino/RingBuffer.cpp.o
rm -f ./arduino/Stream.cpp.o
rm -f ./arduino/UARTClass.cpp.o
rm -f ./arduino/USARTClass.cpp.o
rm -f ./arduino/WInterrupts.c.o
rm -f ./arduino/WMath.cpp.o
rm -f ./arduino/WString.cpp.o
rm -f ./arduino/abi.cpp.o
rm -f ./arduino/cortex_handlers.c.o
rm -f ./arduino/hooks.c.o
rm -f ./arduino/iar_calls_sam3.c.o
rm -f ./arduino/itoa.c.o
rm -f ./arduino/main.cpp.o
rm -f ./arduino/new.cpp.o
rm -f ./arduino/syscalls_sam3.c.o
rm -f ./arduino/wiring.c.o
rm -f ./arduino/wiring_analog.c.o
rm -f ./arduino/wiring_digital.c.o
rm -f ./arduino/wiring_pulse.cpp.o
rm -f ./arduino/wiring_shift.c.o
rm -f ./DDA.cpp.d
rm -f ./DeltaParameters.cpp.d
rm -f ./DeltaProbe.cpp.d
rm -f ./DriveMovement.cpp.d
rm -f ./GCodeBuffer.cpp.d
rm -f ./GCodes.cpp.d
rm -f ./Heat.cpp.d
rm -f ./Isqrt.cpp.d
rm -f ./Move.cpp.d
rm -f ./Network.cpp.d
rm -f ./Platform.cpp.d
rm -f ./PrintMonitor.cpp.d
rm -f ./RepRapFirmware.cpp.d
rm -f ./Tool.cpp.d
rm -f ./Webserver.cpp.d
rm -f ./arduino/variant.cpp.d
rm -f ./arduino/CDC.cpp.d
rm -f ./arduino/HID.cpp.d
rm -f ./arduino/USBCore.cpp.d
rm -f ./arduino/IPAddress.cpp.d
rm -f ./arduino/Print.cpp.d
rm -f ./arduino/Reset.cpp.d
rm -f ./arduino/RingBuffer.cpp.d
rm -f ./arduino/Stream.cpp.d
rm -f ./arduino/UARTClass.cpp.d
rm -f ./arduino/USARTClass.cpp.d
rm -f ./arduino/WMath.cpp.d
rm -f ./arduino/WString.cpp.d
rm -f ./arduino/abi.cpp.d
rm -f ./arduino/main.cpp.d
rm -f ./arduino/new.cpp.d
rm -f ./arduino/wiring_pulse.cpp.d
rm -f ./Libraries/Wire/Wire.cpp.d
rm -f ./Libraries/SamNonDuePin/SamNonDuePin.cpp.d
rm -f ./Libraries/MCP4461/MCP4461.cpp.d
rm -f ./Libraries/Flash/DueFlashStorage.cpp.d
rm -f ./Libraries/Flash/efc.cpp.d
rm -f ./Libraries/Flash/flash_efc.cpp.d
rm -f ./DDA.cpp.o
rm -f ./DeltaParameters.cpp.o
rm -f ./DeltaProbe.cpp.o
rm -f ./DriveMovement.cpp.o
rm -f ./GCodeBuffer.cpp.o
rm -f ./GCodes.cpp.o
rm -f ./Heat.cpp.o
rm -f ./Isqrt.cpp.o
rm -f ./Move.cpp.o
rm -f ./Network.cpp.o
rm -f ./Platform.cpp.o
rm -f ./PrintMonitor.cpp.o
rm -f ./RepRapFirmware.cpp.o
rm -f ./Tool.cpp.o
rm -f ./Webserver.cpp.o
rm -f ./Libraries/Wire/Wire.cpp.o
rm -f ./Libraries/SamNonDuePin/SamNonDuePin.cpp.o
rm -f ./Libraries/SD_HSMCI/utility/ccsbcs.c.o
rm -f ./Libraries/SD_HSMCI/utility/ctrl_access.c.o
rm -f ./Libraries/SD_HSMCI/utility/diskio.c.o
rm -f ./Libraries/SD_HSMCI/utility/dmac.c.o
rm -f ./Libraries/SD_HSMCI/utility/fattime_rtc.c.o
rm -f ./Libraries/SD_HSMCI/utility/ff.c.o
rm -f ./Libraries/SD_HSMCI/utility/hsmci.c.o
rm -f ./Libraries/SD_HSMCI/utility/rtc.c.o
rm -f ./Libraries/SD_HSMCI/utility/sd_mmc.c.o
rm -f ./Libraries/SD_HSMCI/utility/sd_mmc_mem.c.o
rm -f ./Libraries/MCP4461/MCP4461.cpp.o
rm -f ./Libraries/Lwip/lwip/src/sam/netif/ethernetif.c.o
rm -f ./Libraries/Lwip/lwip/src/netif/etharp.c.o
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/autoip.c.o
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/icmp.c.o
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/igmp.c.o
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/inet.c.o
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/inet_chksum.c.o
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/ip.c.o
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/ip_addr.c.o
rm -f ./Libraries/Lwip/lwip/src/core/ipv4/ip_frag.c.o
rm -f ./Libraries/Lwip/lwip/src/core/def.c.o
rm -f ./Libraries/Lwip/lwip/src/core/dhcp.c.o
rm -f ./Libraries/Lwip/lwip/src/core/dns.c.o
rm -f ./Libraries/Lwip/lwip/src/core/init.c.o
rm -f ./Libraries/Lwip/lwip/src/core/lwip_timers_140.c.o
rm -f ./Libraries/Lwip/lwip/src/core/mem.c.o
rm -f ./Libraries/Lwip/lwip/src/core/memp.c.o
rm -f ./Libraries/Lwip/lwip/src/core/netif.c.o
rm -f ./Libraries/Lwip/lwip/src/core/pbuf.c.o
rm -f ./Libraries/Lwip/lwip/src/core/raw.c.o
rm -f ./Libraries/Lwip/lwip/src/core/stats.c.o
rm -f ./Libraries/Lwip/lwip/src/core/sys.c.o
rm -f ./Libraries/Lwip/lwip/src/core/tcp.c.o
rm -f ./Libraries/Lwip/lwip/src/core/tcp_in.c.o
rm -f ./Libraries/Lwip/lwip/src/core/tcp_out.c.o
rm -f ./Libraries/Lwip/lwip/src/core/udp.c.o
rm -f ./Libraries/Lwip/lwip/src/api/api_lib.c.o
rm -f ./Libraries/Lwip/lwip/src/api/api_msg.c.o
rm -f ./Libraries/Lwip/lwip/src/api/err.c.o
rm -f ./Libraries/Lwip/lwip/src/api/netbuf.c.o
rm -f ./Libraries/Lwip/lwip/src/api/netdb.c.o
rm -f ./Libraries/Lwip/lwip/src/api/netifapi.c.o
rm -f ./Libraries/Lwip/lwip/src/api/sockets.c.o
rm -f ./Libraries/Lwip/lwip/src/api/tcpip.c.o
rm -f ./Libraries/Lwip/contrib/apps/netbios/netbios.c.o
rm -f ./Libraries/Flash/DueFlashStorage.cpp.o
rm -f ./Libraries/Flash/efc.cpp.o
rm -f ./Libraries/Flash/flash_efc.cpp.o
rm -f ./Libraries/EMAC/ethernet_phy.c.o
rm -f ./Libraries/EMAC/ethernet_sam.c.o
rm -f RepRapFirmware

@jantje
Copy link
Member

jantje commented Jul 23, 2015

I just looked at the makefile in a workspace of mine -a project called zero- and I see something I don't like

Other Targets

clean:
-$(RM) $(AR)$(C_DEPS)$(FLASH_IMAGE)$(EEP)$(CXX_DEPS)$(S_UPPER_DEPS)$(ELF)$(C++_DEPS)$(ASM_DEPS)$(CC_DEPS)$(INO_DEPS)$(AR_OBJ)$(CPP_DEPS)$(PDE_DEPS)$(LINK_OBJ)$(C_UPPER_DEPS)$(SIZEDUMMY) zero
-@echo ' '

It looks like zero (the project name) is hardcoded in the clean command. That must be where your RepRapFirmware comes from.

@jantje
Copy link
Member

jantje commented Jul 23, 2015

I looked at the code and did some tests.
I filled in outputprefix (./) and artefact extension (.out) and now I get ./zero.out
When I replaced ${ProjName} with "d d" I get "./d d.out"
I tried to rename my project to / which was not allowed then I tried to rename it to \ which works but now the makefile gives an error (refuses to do clean)
It all looks pretty safe to me until now.

@jantje
Copy link
Member

jantje commented Nov 26, 2015

Has this ever happened again to anyone?
It never happened to me.

@dcnewman
Copy link

I made sure that the plugin ran a shell script rather than the actual rm binary. Via the shell script, I protected myself against it happening again and I don't rightly know if it did happen again.... When it was happening, it was repeatable. In the brief time I continued to use Eclipse -- I've never cared for IDEs -- I do not know offhand if it again occurred. I've since moved the project to a command-line based build environment and removed Eclipse and the plugins.

@wimjongman
Copy link
Member

I don't know if this was ever suggested but if the variable substitution does not work then

rm -rf {project}/{configuration}

becomes

rm -rf /

@jantje
Copy link
Member

jantje commented Nov 28, 2015

This has been open for a long time so I did some rereading to freshen up.
My conclusion is that we should simply remove the r from the command making the command rm -f
I tried here on my system and rm -f / is safe

bash-4.1$ rm -f /
rm: cannot remove /': Is a directory bash-4.1$ rm -f . rm: cannot remove.': Is a directory

@jantje
Copy link
Member

jantje commented Nov 28, 2015

@wimjongman
I'm sorry for assigning this to you (way much later than you requested because I had overlooked it) and then fixing it in 3 hours myself (because after rereading I found the fix to be easy).
Jantje

@jantje jantje added status: fixed in 2.4 and removed status: no good solution found (yet) We don't know how to fix this. status: waiting for input OP was requested to provide more info. (issues in this state longer than a month will be closed) labels Nov 28, 2015
@cyberreefguru
Copy link
Author

removing the r does not fix the problem; it just stops directories from being deleted. if the parameters are null, it will still delete all regular files in the root directory without asking. Secondarily, it will no longer remove the subdirectories in the build area as intended during a clean build.

On Nov 28, 2015, at 11:00 AM, jantje [email protected] wrote:

This has been open for a long time so I did some rereading to freshen up.
My conclusion is that we should simply remove the r from the command making the command rm -f
I tried here on my system and rm -f / is safe

bash-4.1$ rm -f /
rm: cannot remove /': Is a directory
bash-4.1$ rm -f .
rm: cannot remove.': Is a directory


Reply to this email directly or view it on GitHub #91 (comment).

@jantje
Copy link
Member

jantje commented Nov 28, 2015

removing the r does not fix the problem;

I think it does

it just stops directories from being deleted.

the r stands for recursive all subdirectories. So without -r rm can never do again what OP reported "it attempted to remove everything from my computer."

if the parameters are null, it will still delete all regular files in the root directory without asking.

Can you be more specific, I mean: on a command line; parameters can not be null. IMHO To delete all files one needs to use wildcards (which has never been reported as happened) or remove a folder (recursively) which the fix makes impossible to happen.
In other words: can you provide me with a
rm -f XXX.c.d XXX.c.o YYY.cpp.d YYY.cpp.o ZZZ.ar ...
command where XXX, YYY ZZZ do not contain wildcards and that "When run at a wrong location" is bad for the user's mental health?

Secondarily, it will no longer remove the subdirectories in the build area as intended during a clean build.

Have you checked the logs above and the actual behaviour of the cdt? The pre fix behaviour does not remove the folders.
Why? Because it does not want to remove the generated make files.

@jantje jantje closed this as completed Nov 28, 2015
@cyberreefguru
Copy link
Author

Jantje -

As far as I know, the -r flag recursively removes all files regardless of type. -f merely surpasses warnings and forces a remove if the user has the appropriate permissions. So, removing the -r allows any appropriately permissioned user to remove all regular files from the specified directory but does not allow the user to remove the directories.

In the case of this specific failure mode, the input parameters are null, or blank as CDT interprets them. Which results in an "rm -rf /" command rather than rm -rf {project}/{configuration}” as intended. So the recommended change will issue a command that will remove all regular files at the root directory that the user is allowed to remove by executing “rm -f /“ when the input parameters are null/blank. In some cases that results in nothing being removed, in other cases that may comprise important things in the root directory.

The recommended changes does not get to the root cause of why the parameters are null (or blank). There is no possible regex-style rm function that will operate correctly when the parameters that set the base directory are blank or null.

I believe Dan has already proved under certain circumstances the operation does not perform as intended. I have not been able to reliably reproduce the parameters that lead to the error. I think Dan or Will have but I’m not entirely sure.

I’ve been following your project for a long time and I’ve been using it for even longer. I know it’s a lot of work keeping the plugin going and operating properly with the very dynamic nature of the arduino platform. However, simply closing the issue when the root cause has not appropriately been identified or remediated is fairly shortsighted in my mind. I’m pretty sure at this point you will suggest I dig into the code and fix the issue myself - trust me, I have tried without any luck. I happy to try again.

-Tom

On Nov 28, 2015, at 5:56 PM, jantje [email protected] wrote:

removing the r does not fix the problem;

I think it does

it just stops directories from being deleted.

the r stands for recursive all subdirectories. So without -r rm can never do again what OP reported "it attempted to remove everything from my computer."

if the parameters are null, it will still delete all regular files in the root directory without asking.

Can you be more specific, I mean: on a command line; parameters can not be null. IMHO To delete all files one needs to use wildcards (which has never been reported as happened) or remove a folder (recursively) which the fix makes impossible to happen.
In other words: can you provide me with a
rm -f XXX.c.d XXX.c.o YYY.cpp.d YYY.cpp.o ZZZ.ar ...
command where XXX, YYY ZZZ do not contain wildcards and that "When run at a wrong location" is bad for the user's mental health?

Secondarily, it will no longer remove the subdirectories in the build area as intended during a clean build.

Have you checked the logs above and the actual behaviour of the cdt? The pre fix behaviour does not remove the folders.
Why? Because it does not want to remove the generated make files.


Reply to this email directly or view it on GitHub #91 (comment).

@wimjongman
Copy link
Member

However, simply closing the issue when the root cause has not appropriately been identified or remediated is fairly shortsighted in my mind.

Thank you for your nice words. A real motivation to keep going.

@jantje
Copy link
Member

jantje commented Nov 29, 2015

I’m pretty sure at this point you will suggest I dig into the code and fix the issue myself - trust me, I have tried without any luck. I happy to try again.

I propose you dig in the cdt code as it is probably a cdt issue or maybe even a eclipse issue.
As the root cause is a cdt/eclipse issue which became worse with the -r I think removing the -r fixes the arduino eclipse plugin issue without any negative drawbacks I think this issue (on the arduino eclipse plugin) can and should be closed.
From my point of view this issue only creates fear in the harts of potential plugin users. By removing the r from the rm there is no reason to fear. The r should never have been there in the first place.

I will now lock this conversation because this conversation has caused to much harm to the plugin without any proof this actually ever happened. And with the -r removed it can no longer happen.

I know this solution is more a work around than a 'solution as you are used of this plugin' but there are only so much things we can do.
FYI I tried but hanging cdt or eclipse is not part of my capabilities.

Best regards
Jantje

@Sloeber Sloeber locked and limited conversation to collaborators Nov 29, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants