title: patch: Only garbage was found in the patch input
body: <p>I produced a diff.txt file with the command (executed from ~):</p>
  
  <pre><code>diff -r /full/path/to/directory/A /full/path/to/directory/B &gt; diff.txt
  </code></pre>
  
  <p>The generated diff file looks good.</p>
  
  <p>Now I run (always from ~)</p>
  
  <pre><code>patch -p0 &lt;diff.txt
  </code></pre>
  
  <p>or I also tried:</p>
  
  <pre><code>patch &lt;diff.txt
  </code></pre>
  
  <p>I would expect it to apply the changes to the files in /full/path/to/directory/A so that after the operation they will be identical to those in /full/path/to/directory/B</p>
  
  <p>But it only says:
  <em>*</em> Only garbage was found in the patch input.</p>
  
  <p>What am I missing?</p>
  
  <p>EDIT: Here is the whole diff file:</p>
  
  <pre><code>diff /media/DATA/lavoro/eclipse_workspace/ODK Collect/src/net/xxx/collect/android/activities/FormEntryActivity.java /media/DATA/lavoro/xxx/backups/odk src embedded maps/net/xxx/collect/android/activities/FormEntryActivity.java
  21a22,27
  &gt; 
  &gt; import com.google.android.maps.GeoPoint;
  &gt; import com.google.android.maps.MapActivity;
  &gt; import com.google.android.maps.MapView;
  &gt; import com.google.android.maps.MyLocationOverlay;
  &gt; 
  36a43
  &gt; import net.xxx.collect.android.widgets.GeoPointWidget;
  50a58,60
  &gt; import android.location.Location;
  &gt; import android.location.LocationListener;
  &gt; import android.location.LocationManager;
  86a97
  &gt; import java.util.List;
  96,97c107,108
  &lt; public class FormEntryActivity extends Activity implements AnimationListener, FormLoaderListener,
  &lt;         FormSavedListener, AdvanceToNextListener, OnGestureListener {
  ---
  &gt; public class FormEntryActivity extends MapActivity implements AnimationListener, FormLoaderListener,
  &gt;         FormSavedListener, AdvanceToNextListener, OnGestureListener, LocationListener  {
  115a127,133
  &gt;     
  &gt;     // Release:
  &gt;     private static final String GMAPS_API_KEY="0SH1_CwvF7Nn4_kT8NcGTc8vMCjrqIdpXOjSqcA";
  &gt; 
  &gt;     // Debug:
  &gt;     //private static final String GMAPS_API_KEY="0SH1_CwvF7Nm8oPeWuNskdKCKKWZ1VlGx6mqTfg";
  &gt; 
  162a181,190
  &gt;     
  &gt;     private MapView mMapView;
  &gt;     private boolean mGPSOn = false;
  &gt;     private boolean mNetworkOn = false;
  &gt;     private MyLocationOverlay mLocationOverlay;
  &gt;     private LocationManager mLocationManager;
  &gt;     private Location mLocation;
  &gt;     private GeoPoint mGeoPoint;
  &gt;     
  &gt;     private boolean flingEnabled=true;
  171a200
  &gt;       Log.d(t, "onCreate "+(savedInstanceState==null?"":" with savedInstanceState"));
  207a237,240
  &gt;                 Log.d(t, "savedInstanceState "+(newForm?"seems":"does not seem")+" to be a new form");
  &gt;             }
  &gt;             else {
  &gt;               Log.d(t, "savedInstanceState does not have a newForm key");
  223a257
  &gt;           Log.d(t,"Last non configuration instance is a FormLoaderTask");
  225a260
  &gt;           Log.d(t,"Last non configuration instance is a SaveToDiskTask");
  227a263
  &gt;           Log.d(t,"Last non configuration instance is null");
  228a265
  &gt;               Log.d(t,"  and the form is not new");
  298a336,360
  &gt;         
  &gt;         
  &gt;         mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
  &gt;         List&lt;String&gt; providers = mLocationManager.getProviders(true);        
  &gt;         for (String provider : providers) {
  &gt;             if (provider.equalsIgnoreCase(LocationManager.GPS_PROVIDER)) {
  &gt;                 mGPSOn = true;
  &gt;             }
  &gt;             if (provider.equalsIgnoreCase(LocationManager.NETWORK_PROVIDER)) {
  &gt;                 mNetworkOn = true;
  &gt;             }
  &gt;         }
  &gt;         if (!mGPSOn &amp;&amp; !mNetworkOn) {
  &gt;             Toast.makeText(getBaseContext(), getString(R.string.provider_disabled_error),
  &gt;                 Toast.LENGTH_SHORT).show();
  &gt;             //finish();
  &gt;         }
  &gt;         
  &gt;     }
  &gt;     
  &gt;     public void enableFling() {
  &gt;       flingEnabled=true;
  &gt;     }
  &gt;     public void disableFling() {
  &gt;       flingEnabled=false;
  300d361
  &lt; 
  303a365
  &gt;       Log.d(t,"onSavedInstanceState");
  312a375
  &gt;       Log.d(t,"onActivityResult "+requestCode+" "+resultCode+" "+intent.getAction());
  457a521
  &gt;       Log.d(t,"refreshCurrentView");
  610a675
  &gt;       Log.d(t,"onRetainNonConfigurationInstance");
  612,613c677,680
  &lt;         if (mFormLoaderTask != null &amp;&amp; mFormLoaderTask.getStatus() != AsyncTask.Status.FINISHED)
  &lt;             return mFormLoaderTask;
  ---
  &gt;         if (mFormLoaderTask != null &amp;&amp; mFormLoaderTask.getStatus() != AsyncTask.Status.FINISHED){
  &gt;           Log.d(t,"  returning mFormLoaderTask");
  &gt;             
  &gt;           return mFormLoaderTask;
  614a682,683
  &gt;         }
  &gt;           
  616,618c685,689
  &lt;         if (mSaveToDiskTask != null &amp;&amp; mSaveToDiskTask.getStatus() != AsyncTask.Status.FINISHED)
  &lt;             return mSaveToDiskTask;
  &lt; 
  ---
  &gt;         if (mSaveToDiskTask != null &amp;&amp; mSaveToDiskTask.getStatus() != AsyncTask.Status.FINISHED) {
  &gt;           Log.d(t,"  returning mSaveToDisk");
  &gt;         
  &gt;           return mSaveToDiskTask;
  &gt;         }
  620a692
  &gt;           Log.d(t,   "  just saving answers. No need to pass mFormController");
  622a695
  &gt;         Log.d(t,"  returning null");
  772c845
  &lt;     private void showNextView() {
  ---
  &gt;     public void showNextView() {
  1316a1390,1391
  &gt;         mLocationManager.removeUpdates(this);
  &gt;         if (mLocationOverlay!=null) mLocationOverlay.disableMyLocation();
  1322a1398
  &gt;       Log.d(t,"nResume");
  1323a1400,1407
  &gt;         if (mLocationOverlay!=null) mLocationOverlay.enableMyLocation();
  &gt;         if (mGPSOn) {
  &gt;             mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
  &gt;         }
  &gt;         if (mNetworkOn) {
  &gt;             mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
  &gt;         }
  &gt;         
  1337a1422,1426
  &gt;         
  &gt;         
  &gt;         
  &gt; 
  &gt;         
  1367a1457,1477
  &gt;       Log.d(t,"---- onDestroy ----");
  &gt;       boolean problem=false;
  &gt;       if (mFormLoaderTask != null &amp;&amp; mFormLoaderTask.getStatus() != AsyncTask.Status.FINISHED){
  &gt;           Log.d(t,"  I wish I could retain mFormLoaderTask");
  &gt;             problem=true;
  &gt;         }
  &gt;       else if (mSaveToDiskTask != null &amp;&amp; mSaveToDiskTask.getStatus() != AsyncTask.Status.FINISHED) {
  &gt;           Log.d(t,"  I wish I could retain mSaveToDisk");
  &gt;           problem=true;
  &gt;         }
  &gt;       else if (mFormController != null &amp;&amp; currentPromptIsQuestion()) {
  &gt;           Log.d(t,   "  I wish I had the opportunity to save answers");
  &gt;           problem=true;
  &gt;         }
  &gt;       
  &gt;       if (!problem) Log.d(t,"  everything seems ok");
  &gt;         
  &gt;         
  &gt;         
  &gt;       
  &gt;       
  1369c1479
  &lt;             mFormLoaderTask.setFormLoaderListener(null);
  ---
  &gt;           mFormLoaderTask.setFormLoaderListener(null);
  1373a1484
  &gt;               Log.d(t,"  Cancelling and destroying form loader task");
  1376a1488,1489
  &gt;             else Log.d(t,"  Not cancelling form loader task because it's not done");
  &gt;             
  1382a1496
  &gt;               Log.d(t,"  Cancelling save to disk task");
  1394a1509,1512
  &gt;         if (mCurrentView!=null &amp;&amp; mCurrentView instanceof ODKView)
  &gt;           for (QuestionWidget qw : ((ODKView) mCurrentView).getWidgets()) {
  &gt;               qw.onInAnimationDone();
  &gt;             }
  1607c1725,1726
  &lt;         if (Math.abs(e1.getX() - e2.getX()) &gt; 60 &amp;&amp; Math.abs(e1.getY() - e2.getY()) &lt; 60) {
  ---
  &gt;         if (!flingEnabled) return false;
  &gt;       if (Math.abs(e1.getX() - e2.getX()) &gt; 60 &amp;&amp; Math.abs(e1.getY() - e2.getY()) &lt; 60) {
  1631c1750
  &lt;         // We don't wnat that, so cancel it.
  ---
  &gt;         // We don't want that, so cancel it.
  1645a1765,1842
  &gt; 
  &gt; 
  &gt;   @Override
  &gt;   protected boolean isRouteDisplayed() {
  &gt;       // TODO Auto-generated method stub
  &gt;       return false;
  &gt;   }
  &gt;   
  &gt;   public MapView getMapView() {
  &gt;       if (mMapView==null) {
  &gt;           Log.d("FormEntryActivity", "Creating MapView");
  &gt;           mMapView=new MapView(this, GMAPS_API_KEY);
  &gt;           mMapView.setBuiltInZoomControls(true);
  &gt;           mMapView.setSatellite(false);
  &gt;           mMapView.getController().setZoom(16);
  &gt;           createLocationOverlay();
  &gt;       }
  &gt;       return mMapView;
  &gt;   }
  &gt;   public MyLocationOverlay getLocationOverlay() {
  &gt;       return mLocationOverlay;
  &gt;   }
  &gt;   
  &gt;   public void createLocationOverlay() {
  &gt;       Log.d("FormEntryActivity", "createLocationOverlay");
  &gt;       mLocationOverlay=new MyLocationOverlay(this,mMapView);
  &gt;         mMapView.getOverlays().add(mLocationOverlay);
  &gt;         mLocationOverlay.enableMyLocation();
  &gt;   }
  &gt; 
  &gt; 
  &gt;   @Override
  &gt;   public void onLocationChanged(Location location) {
  &gt;         if (true) {
  &gt;           Log.d("FormEntryActivity", "onLocationChanged");
  &gt;             mLocation = location;
  &gt;             if (mLocation != null) {
  &gt;                
  &gt;                 mGeoPoint =
  &gt;                     new GeoPoint((int) (mLocation.getLatitude() * 1E6),
  &gt;                             (int) (mLocation.getLongitude() * 1E6));
  &gt;                 if (mCurrentView!=null &amp;&amp; mCurrentView instanceof ODKView)
  &gt;                   for (QuestionWidget qw : ((ODKView) mCurrentView).getWidgets()) {
  &gt;                       if (qw instanceof GeoPointWidget) {
  &gt;                           ((GeoPointWidget)qw).onLocationChanged();
  &gt;                       }
  &gt;                   }
  &gt;                 
  &gt;             }
  &gt;         }
  &gt;     }
  &gt;   public GeoPoint getGeoPoint() {
  &gt;       return mGeoPoint;
  &gt;   }
  &gt;   public Location getLocation() {
  &gt;       return mLocation;
  &gt;   }
  &gt; 
  &gt; 
  &gt;   @Override
  &gt;   public void onProviderDisabled(String provider) {
  &gt;       // TODO Auto-generated method stub
  &gt;       
  &gt;   }
  &gt; 
  &gt; 
  &gt;   @Override
  &gt;   public void onProviderEnabled(String provider) {
  &gt;       // TODO Auto-generated method stub
  &gt;       
  &gt;   }
  &gt; 
  &gt; 
  &gt;   @Override
  &gt;   public void onStatusChanged(String provider, int status, Bundle extras) {
  &gt;       // TODO Auto-generated method stub
  &gt;       
  &gt;   }
  diff -r /media/DATA/lavoro/eclipse_workspace/ODK Collect/src/net/xxx/collect/android/widgets/GeoPointWidget.java /media/DATA/lavoro/xxx/backups/odk src embedded maps/net/xxx/collect/android/widgets/GeoPointWidget.java
  19a20,24
  &gt; 
  &gt; import com.google.android.maps.GeoPoint;
  &gt; import com.google.android.maps.MapView;
  &gt; import com.google.android.maps.Overlay;
  &gt; 
  27a33
  &gt; import android.location.Location;
  31a38
  &gt; import android.view.ViewGroup;
  34a42
  &gt; import android.widget.RelativeLayout;
  37a46
  &gt; import java.util.List;
  47a57
  &gt;     private Button mAcceptButton;
  55c65,73
  &lt; 
  ---
  &gt;     
  &gt;     private MapView mMapView;
  &gt;     private FormEntryActivity mFEA;
  &gt;     private TextView mLocationStatus;
  &gt;    
  &gt;     private RelativeLayout mMapContainerLayout;
  &gt;     
  &gt;     private LinearLayout.LayoutParams lp;
  &gt;     RelativeLayout.LayoutParams rlp;
  59c77,79
  &lt; 
  ---
  &gt;         
  &gt;         
  &gt;         
  113c133
  &lt;         if (mAppearance != null &amp;&amp; mAppearance.equalsIgnoreCase("maps")) {
  ---
  &gt;         if (mAppearance == null || mAppearance.equalsIgnoreCase("maps")) {
  133,141c153
  &lt;                 Intent i = null;
  &lt;                 if (mUseMaps) {
  &lt;                     i = new Intent(getContext(), GeoPointMapActivity.class);
  &lt;                 } else {
  &lt;                     i = new Intent(getContext(), GeoPointActivity.class);
  &lt;                 }
  &lt;                 ((Activity) getContext()).startActivityForResult(i,
  &lt;                     FormEntryActivity.LOCATION_CAPTURE);
  &lt;                 mWaitingForData = true;
  ---
  &gt;                 launchMap();
  148,149c160,186
  &lt; 
  &lt;         addView(mGetLocationButton);
  ---
  &gt;         mFEA=(FormEntryActivity)context;
  &gt;         //addView(mGetLocationButton);
  &gt;         Log.d("GeoPointWidget","Adding ViewMap in constructor");
  &gt;         
  &gt;         setUpMapContainer();
  &gt;     }
  &gt;     
  &gt;     protected void setUpMapContainer() {
  &gt;       lp=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
  &gt;       lp.setMargins(0, 0, 0, 0);
  &gt;       
  &gt;       rlp=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
  &gt;       rlp.setMargins(0, 0, 0, 0);
  &gt;       
  &gt;       mMapContainerLayout=new RelativeLayout(mFEA);
  &gt;       mMapContainerLayout.setLayoutParams(lp);
  &gt;       
  &gt;       this.addView(mMapContainerLayout);
  &gt;     }
  &gt;     
  &gt;     @Override
  &gt;     protected void addQuestionText(FormEntryPrompt p) {
  &gt;       return;
  &gt;     }
  &gt;     
  &gt;     private void launchMap() {
  &gt;       Intent i = null;
  151c188,190
  &lt;             addView(mViewButton);
  ---
  &gt;             i = new Intent(getContext(), GeoPointMapActivity.class);
  &gt;         } else {
  &gt;             i = new Intent(getContext(), GeoPointActivity.class);
  153c192,270
  &lt;         addView(mAnswerDisplay);
  ---
  &gt;         ((Activity) getContext()).startActivityForResult(i,
  &gt;             FormEntryActivity.LOCATION_CAPTURE);
  &gt;         mWaitingForData = true;
  &gt;     }
  &gt;     @Override
  &gt;     public void onInAnimationDone() {
  &gt;       addMapView();
  &gt;     }
  &gt;     
  &gt;     protected void addMapView() {
  &gt;       if (mUseMaps) {
  &gt;             //addView(mViewButton);
  &gt;           mMapView=(mFEA).getMapView();
  &gt;           if (mMapView.getParent()!=null) {
  &gt;               ((ViewGroup)(mMapView.getParent())).removeView(mMapView);
  &gt;               
  &gt;           }
  &gt;           
  &gt;           mMapView.setLayoutParams(rlp);
  &gt;           mMapContainerLayout.addView(mMapView);
  &gt;           
  &gt;           View mapButtons=View.inflate(mFEA, R.layout.map_buttons_layout, null);
  &gt;           mMapContainerLayout.addView(mapButtons);
  &gt;           
  &gt;           mLocationStatus=(TextView)findViewById(R.id.location_status);
  &gt;           
  &gt;           
  &gt;           
  &gt;           /*
  &gt;           this.setLayoutParams(lp);
  &gt;           LinearLayout p=this;
  &gt;           while (p!=null) {
  &gt;               if (p.getParent()!=null &amp;&amp; p.getParent() instanceof LinearLayout) {
  &gt;                   p.setLayoutParams(lp);
  &gt;                   p.invalidate();
  &gt;                   p=(LinearLayout)(p.getParent());
  &gt;                   
  &gt;               } 
  &gt;               else {
  &gt;                   break;
  &gt;               }
  &gt;           }
  &gt;           if (p.getParent()!=null &amp;&amp; p.getParent() instanceof RelativeLayout) {
  &gt;               RelativeLayout r=(RelativeLayout)(p.getParent());
  &gt;               RelativeLayout.LayoutParams lpr=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
  &gt;               lpr.setMargins(0,0,0,0);
  &gt;               p.setLayoutParams(lpr);
  &gt;               r.invalidate();
  &gt;           }
  &gt;           */
  &gt;           mMapView.setClickable(true);
  &gt;           mMapView.setBuiltInZoomControls(true);
  &gt;           mMapView.displayZoomControls(false);
  &gt;           mMapView.setSatellite(false);
  &gt;           mMapView.getController().setZoom(24);
  &gt;           List&lt;Overlay&gt; overlays=mMapView.getOverlays();
  &gt;           if (overlays.size()==0) {
  &gt;               Log.d("GeoPointWidget","Creating Location Overlay (from constructor)");
  &gt;               mFEA.createLocationOverlay();
  &gt;           }
  &gt;           mMapView.invalidate();
  &gt;           
  &gt;           mAcceptButton=(Button)findViewById(R.id.accept_location);
  &gt;           //mAcceptButton.setEnabled(false);
  &gt;           mAcceptButton.setText(R.string.cancel_location);
  &gt;           mAcceptButton.setOnClickListener(new View.OnClickListener() {
  &gt;                 @Override
  &gt;                 public void onClick(View v) {
  &gt;                   acceptOrSkip();
  &gt;                 }
  &gt;             });
  &gt;           
  &gt;           
  &gt;           if (mFEA.getGeoPoint()!=null) onLocationChanged();
  &gt;           
  &gt;           mFEA.disableFling();
  &gt;         }
  &gt;        //addView(mAnswerDisplay);
  &gt;       
  155d271
  &lt; 
  163a280,284
  &gt;     
  &gt;     private void acceptOrSkip() {
  &gt;       mFEA.enableFling();
  &gt;       mFEA.showNextView();
  &gt;     }
  269a391,414
  &gt;     }
  &gt;     private String truncateFloat(float f) {
  &gt;         return new DecimalFormat("#.##").format(f);
  &gt;     }
  &gt;     public void onLocationChanged() {
  &gt;        //We need the mLocationStatus text view
  &gt;       if (mMapView==null) return;
  &gt;       if (mLocationStatus!=null) 
  &gt;           mLocationStatus.setText(getContext().getString(R.string.location_provider_accuracy,
  &gt;                  mFEA.getLocation().getProvider(), truncateFloat(mFEA.getLocation().getAccuracy())));
  &gt;       if (mAcceptButton!=null) mAcceptButton.setText(R.string.accept_location);
  &gt;       Log.d("GeoPointWidget","onLocationChanged. Overlays: "+(mMapView.getOverlays().size()));
  &gt;         GeoPoint gp=mFEA.getGeoPoint();
  &gt;       if (gp!=null) mMapView.getController().animateTo(mFEA.getGeoPoint());
  &gt;       List&lt;Overlay&gt; overlays=mMapView.getOverlays();
  &gt;       if (overlays.size()==0) {
  &gt;           Log.d("GeoPointWidget","Creating Location Overlay");
  &gt;           mFEA.createLocationOverlay();
  &gt;       }
  &gt;       Location location=mFEA.getLocation();
  &gt;       if (location!=null) {
  &gt;           setBinaryData(location.getLatitude() + " " + location.getLongitude() + " "
  &gt;           + location.getAltitude() + " " + location.getAccuracy(), false);
  &gt;       }
  diff -r /media/DATA/lavoro/eclipse_workspace/ODK Collect/src/net/xxx/collect/android/widgets/ImageWidget.java /media/DATA/lavoro/xxx/backups/odk src embedded maps/net/xxx/collect/android/widgets/ImageWidget.java
  330c330,335
  &lt;         if (mBinaryName==null) {
  ---
  &gt;         
  &gt;     }
  &gt;     
  &gt;     @Override
  &gt;     public void onInAnimationDone() {
  &gt;       if (mBinaryName==null) {
  diff -r /media/DATA/lavoro/eclipse_workspace/ODK Collect/src/net/xxx/collect/android/widgets/QuestionWidget.java /media/DATA/lavoro/xxx/backups/odk src embedded maps/net/xxx/collect/android/widgets/QuestionWidget.java
  147a148,151
  &gt;     
  &gt;     public void onInAnimationDone() {
  &gt;       
  &gt;     }
  </code></pre>